Class: SimpleFactory::HashDefinitions
- Inherits:
-
Object
- Object
- SimpleFactory::HashDefinitions
- Defined in:
- lib/simple_factory/hash_definitions.rb
Instance Attribute Summary collapse
-
#samples ⇒ Object
readonly
Returns the value of attribute samples.
Instance Method Summary collapse
-
#initialize(hash) ⇒ HashDefinitions
constructor
A new instance of HashDefinitions.
Constructor Details
#initialize(hash) ⇒ HashDefinitions
Returns a new instance of HashDefinitions.
7 8 9 10 11 12 13 |
# File 'lib/simple_factory/hash_definitions.rb', line 7 def initialize(hash) if (samples = (hash[:_sample] || hash['_sample'])) @samples = samples.map {|sample| parse_attrs(sample) } else @samples = [parse_attrs(hash)] end end |
Instance Attribute Details
#samples ⇒ Object (readonly)
Returns the value of attribute samples.
5 6 7 |
# File 'lib/simple_factory/hash_definitions.rb', line 5 def samples @samples end |