Class: SimpleFactory::HashDefinitions

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_factory/hash_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#samplesObject (readonly)

Returns the value of attribute samples.



5
6
7
# File 'lib/simple_factory/hash_definitions.rb', line 5

def samples
  @samples
end