Method: NamedArguments#attribute_defaults
- Defined in:
- lib/named_arguments.rb
#attribute_defaults ⇒ Object
Set defaults for the given attributes.
Values can be:
-
A class. The #new method is called with no arguments.
-
A Proc. The proc is called with one argument.
-
[]. A new array is created.
-
{}. A new hash is created.
attribute_defaults :snark => lambda {|s| String.new s.to_s}
attribute_defaults :snark => [], :boojum => ObjectTypeFromSomewhereElse
attribute_defaults :snark => {}
93 94 95 |
# File 'lib/named_arguments.rb', line 93 def attribute_defaults # Dummy for rdoc end |