lib/mongoid/criterion/scrollable.rb in mongoid-scroll-0.2.1 vs lib/mongoid/criterion/scrollable.rb in mongoid-scroll-0.3.0
- old
+ new
@@ -1,15 +1,14 @@
module Mongoid
module Criterion
module Scrollable
-
- def scroll(cursor = nil, &block)
+ def scroll(cursor = nil, &_block)
criteria = self
# we don't support scrolling over a criteria with multiple fields
if criteria.options[:sort] && criteria.options[:sort].keys.size != 1
raise Mongoid::Scroll::Errors::MultipleSortFieldsError.new(sort: criteria.options[:sort])
- elsif ! criteria.options.has_key?(:sort) || criteria.options[:sort].empty?
+ elsif !criteria.options.key?(:sort) || criteria.options[:sort].empty?
# introduce a default sort order if there's none
criteria = criteria.asc(:_id)
end
# scroll field and direction
scroll_field = criteria.options[:sort].keys.first
@@ -25,9 +24,8 @@
end
else
criteria
end
end
-
end
end
end