1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Avoid hash as a variable name

Not sure using `hash` poses any risk, but the Ruby docs use `h` or
`hsh`:

http://www.ruby-doc.org/core-2.1.5/Hash.html
This commit is contained in:
Jon Atack 2014-12-19 13:02:46 +01:00
parent d17ec758f1
commit 846b1687ec
4 changed files with 11 additions and 11 deletions

View file

@ -121,11 +121,11 @@ module Arel
end
def column_cache
@column_cache ||= Hash.new do |hash, key|
hash[key] = Hash[
@engine.connection.columns(key, "#{key} Columns").map do |c|
[c.name, c]
end
@column_cache ||= Hash.new do |h, key|
h[key] = Hash[
@engine.connection
.columns(key, "#{key} Columns")
.map { |c| [c.name, c] }
]
end
end

View file

@ -39,10 +39,10 @@ module Ransack
@default_table = Arel::Table.new(
@base.table_name, :as => @base.aliased_table_name, :engine => @engine
)
@bind_pairs = Hash.new do |hash, key|
@bind_pairs = Hash.new do |h, key|
parent, attr_name = get_parent_and_attribute_name(key.to_s)
if parent && attr_name
hash[key] = [parent, attr_name]
h[key] = [parent, attr_name]
end
end
end

View file

@ -34,10 +34,10 @@ module Ransack
# @default_table = Arel::Table.new(
# @base.table_name, :as => @base.aliased_table_name, :engine => @engine
# )
@bind_pairs = Hash.new do |hash, key|
@bind_pairs = Hash.new do |h, key|
parent, attr_name = get_parent_and_attribute_name(key.to_s)
if parent && attr_name
hash[key] = [parent, attr_name]
h[key] = [parent, attr_name]
end
end
end

View file

@ -52,8 +52,8 @@ module Ransack
send(DISPATCH[object.class], object)
end
DISPATCH = Hash.new do |hash, klass|
hash[klass] = "visit_#{
DISPATCH = Hash.new do |h, klass|
h[klass] = "visit_#{
klass.name.gsub(Constants::TWO_COLONS, Constants::UNDERSCORE)
}"
end