Switching parameter name from key to opts to fix YARD doc

This commit is contained in:
Andy Gregorowicz 2011-01-21 15:43:20 -05:00 committed by Kyle Banker
parent ba38d1a5ab
commit 153bedf5f6
1 changed files with 6 additions and 6 deletions

View File

@ -570,9 +570,9 @@ module Mongo
# set to true. # set to true.
# #
# @return [Array] the command response consisting of grouped items. # @return [Array] the command response consisting of grouped items.
def group(key, condition={}, initial={}, reduce=nil, finalize=nil) def group(opts, condition={}, initial={}, reduce=nil, finalize=nil)
if key.is_a?(Hash) if opts.is_a?(Hash)
return new_group(key) return new_group(opts)
else else
warn "Collection#group no longer take a list of paramters. This usage is deprecated." + warn "Collection#group no longer take a list of paramters. This usage is deprecated." +
"Check out the new API at http://api.mongodb.org/ruby/current/Mongo/Collection.html#group-instance_method" "Check out the new API at http://api.mongodb.org/ruby/current/Mongo/Collection.html#group-instance_method"
@ -589,13 +589,13 @@ module Mongo
} }
} }
if key.is_a?(Symbol) if opts.is_a?(Symbol)
raise MongoArgumentError, "Group takes either an array of fields to group by or a JavaScript function" + raise MongoArgumentError, "Group takes either an array of fields to group by or a JavaScript function" +
"in the form of a String or BSON::Code." "in the form of a String or BSON::Code."
end end
unless key.nil? unless opts.nil?
if key.is_a? Array if opts.is_a? Array
key_type = "key" key_type = "key"
key_value = {} key_value = {}
key.each { |k| key_value[k] = 1 } key.each { |k| key_value[k] = 1 }