Kill trailing whitespace in ruby files
This commit is contained in:
@@ -2,14 +2,14 @@ module Danbooru
|
||||
module Extensions
|
||||
module ActiveRecordApi
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
super(options)
|
||||
end
|
||||
|
||||
|
||||
def to_xml(options = {}, &block)
|
||||
# to_xml ignores serializable_hash
|
||||
options ||= {}
|
||||
@@ -17,7 +17,7 @@ module Danbooru
|
||||
options[:except] += hidden_attributes
|
||||
super(options, &block)
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
def hidden_attributes
|
||||
[:uploader_ip_addr, :updater_ip_addr, :creator_ip_addr, :ip_addr]
|
||||
|
||||
@@ -2,7 +2,7 @@ module Danbooru
|
||||
module Extensions
|
||||
module ActiveRecord
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
||||
module ClassMethods
|
||||
def without_timeout
|
||||
connection.execute("SET STATEMENT_TIMEOUT = 0") unless Rails.env == "test"
|
||||
@@ -20,7 +20,7 @@ module Danbooru
|
||||
connection.execute("SET STATEMENT_TIMEOUT = 3000") unless Rails.env == "test"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%w(execute select_value select_values select_all).each do |method_name|
|
||||
define_method("#{method_name}_sql") do |sql, *params|
|
||||
connection.__send__(method_name, self.class.sanitize_sql_array([sql, *params]))
|
||||
@@ -30,20 +30,20 @@ module Danbooru
|
||||
connection.__send__(method_name, sanitize_sql_array([sql, *params]))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def arbitrary_sql_order_clause(ids, table_name = nil)
|
||||
table_name = self.class.table_name if table_name.nil?
|
||||
|
||||
|
||||
if ids.empty?
|
||||
return "#{table_name}.id desc"
|
||||
end
|
||||
|
||||
|
||||
conditions = []
|
||||
|
||||
|
||||
ids.each_with_index do |x, n|
|
||||
conditions << "when #{x} then #{n}"
|
||||
end
|
||||
|
||||
|
||||
"case #{table_name}.id " + conditions.join(" ") + " end"
|
||||
end
|
||||
end
|
||||
@@ -51,7 +51,7 @@ module Danbooru
|
||||
end
|
||||
|
||||
class ActiveRecord::Base
|
||||
class << self
|
||||
class << self
|
||||
public :sanitize_sql_array
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module Danbooru
|
||||
def to_escaped_for_tsquery
|
||||
"'#{gsub(/'/, '\0\0').gsub(/\\/, '\0\0\0\0')}'"
|
||||
end
|
||||
|
||||
|
||||
def to_escaped_js
|
||||
return self.gsub(/\\/, '\0\0').gsub(/['"]/) {|m| "\\#{m}"}.gsub(/\r\n|\r|\n/, '\\n')
|
||||
end
|
||||
|
||||
@@ -5,6 +5,6 @@ module Danbooru
|
||||
def config
|
||||
@configuration ||= CustomConfiguration.new
|
||||
end
|
||||
|
||||
|
||||
module_function :config
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ end
|
||||
QueryTrace.attach_to :active_record
|
||||
|
||||
trap('QUIT') do
|
||||
# Sending 2 backspace characters removes the ^\ that is
|
||||
# Sending 2 backspace characters removes the ^\ that is
|
||||
# printed to the console.
|
||||
rm_noise = "\b\b"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user