lib/core/facets/hash/argumentize.rb in facets-2.8.4 vs lib/core/facets/hash/argumentize.rb in facets-2.9.0.pre.1
- old
+ new
@@ -1,12 +1,18 @@
class Hash
- # Turn a hash into arguments.
+ # Turn a hash into a method arguments.
#
# h = { :list => [1,2], :base => "HI" }
- # h.argumentize #=> [ [], { :list => [1,2], :base => "HI" } ]
- # h.argumentize(:list) #=> [ [1,2], { :base => "HI" } ]
- # h.argumentize(:base) #=> [ ["HI"], { :list => [1,2] } ]
+ #
+ # Without an argument field.
+ #
+ # h.argumentize #=> [ { :list => [1,2], :base => "HI" } ]
+ #
+ # With an argument field.
+ #
+ # h.argumentize(:list) #=> [ 1, 2, { :base => "HI" } ]
+ # h.argumentize(:base) #=> [ "HI", { :list => [1,2] } ]
#
def argumentize(args_field=nil)
config = dup
if args_field
args = [config.delete(args_field)].flatten.compact