lib/scoped_from/query.rb in scoped_from-0.6.1 vs lib/scoped_from/query.rb in scoped_from-0.7.0
- old
+ new
@@ -1,12 +1,12 @@
module ScopedFrom
class Query
- FALSE_VALUES = %w( false no n off 0 ).freeze
- ORDER_DIRECTIONS = %w( asc desc ).freeze
- TRUE_VALUES = %w( true yes y on 1 ).freeze
+ FALSE_VALUES = %w(false no n off 0).freeze
+ ORDER_DIRECTIONS = %w(asc desc).freeze
+ TRUE_VALUES = %w(true yes y on 1).freeze
attr_reader :params
# Available options are: - :only : to restrict to specified keys.
# - :except : to ignore specified keys.
@@ -85,11 +85,11 @@
def parse_order(value)
column, direction = value.to_s.split(/[\.:\s]+/, 2)
direction = direction.to_s.downcase
direction = ORDER_DIRECTIONS.first unless ORDER_DIRECTIONS.include?(direction)
- @scope.column_names.include?(column) ? { :column => column, :direction => direction } : {}
+ @scope.column_names.include?(column) ? { column: column, direction: direction } : {}
end
def parse_orders(values)
[].tap do |orders|
values.each do |value|
@@ -105,10 +105,10 @@
elsif scope.scope_with_one_argument?(name)
scope.send(name, value)
elsif scope.scope_without_argument?(name)
scope.send(name)
elsif scope.column_names.include?(name.to_s)
- scope.scoped(:conditions => { name => value })
+ scope.scoped(conditions: { name => value })
else
scope
end
end
\ No newline at end of file