Class: Eatr::TransformationSet
- Inherits:
-
Object
- Object
- Eatr::TransformationSet
- Includes:
- Enumerable
- Defined in:
- lib/eatr/transformation_set.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(transformations) ⇒ TransformationSet
constructor
A new instance of TransformationSet.
- #to_a ⇒ Object
Constructor Details
#initialize(transformations) ⇒ TransformationSet
Returns a new instance of TransformationSet.
5 6 7 |
# File 'lib/eatr/transformation_set.rb', line 5 def initialize(transformations) @transformations = transformations end |
Instance Method Details
#each ⇒ Object
9 10 11 12 13 |
# File 'lib/eatr/transformation_set.rb', line 9 def each to_a.each do |t| yield t end end |
#to_a ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eatr/transformation_set.rb', line 15 def to_a @transformations.map do |t| const = Object.const_get(t.fetch('class')) if t['args'] const.new(t['args']) else const.new end end end |