Module: Hashmake::HashMakeable::ClassMethods
- Defined in:
- lib/hashmake/hash_makeable.rb
Overview
Contains class methods to be added to a class that includes the HashMakeable module.
Instance Method Summary collapse
-
#arg_spec(args) ⇒ Object
Helper method to make a generic new ArgSpec object.
-
#arg_spec_array(args) ⇒ Object
Helper method to make a ArgSpec object where the container is an Array.
-
#arg_spec_hash(args) ⇒ Object
Helper method to make a ArgSpec object where the container is an Hash.
Instance Method Details
#arg_spec(args) ⇒ Object
Helper method to make a generic new ArgSpec object
206 207 208 |
# File 'lib/hashmake/hash_makeable.rb', line 206 def arg_spec args ArgSpec.new args end |
#arg_spec_array(args) ⇒ Object
Helper method to make a ArgSpec object where the container is an Array. Set :default to a Proc that generates an empty array.
212 213 214 215 |
# File 'lib/hashmake/hash_makeable.rb', line 212 def arg_spec_array args args = { :container => Array, :default => ->(){Array.new} }.merge(args) ArgSpec.new args end |
#arg_spec_hash(args) ⇒ Object
Helper method to make a ArgSpec object where the container is an Hash. Set :default to a Proc that generates an empty hash.
219 220 221 222 |
# File 'lib/hashmake/hash_makeable.rb', line 219 def arg_spec_hash args args = { :container => Hash, :default => ->(){Hash.new} }.merge(args) ArgSpec.new args end |