Class: Lutaml::Model::Transformer
- Inherits:
-
Object
- Object
- Lutaml::Model::Transformer
- Defined in:
- lib/lutaml/model/services/transformer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Class Method Summary collapse
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(rule, attribute) ⇒ Transformer
constructor
A new instance of Transformer.
Constructor Details
#initialize(rule, attribute) ⇒ Transformer
12 13 14 15 |
# File 'lib/lutaml/model/services/transformer.rb', line 12 def initialize(rule, attribute) @rule = rule @attribute = attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
10 11 12 |
# File 'lib/lutaml/model/services/transformer.rb', line 10 def attribute @attribute end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
10 11 12 |
# File 'lib/lutaml/model/services/transformer.rb', line 10 def rule @rule end |
Class Method Details
.call(value, rule, attribute) ⇒ Object
5 6 7 |
# File 'lib/lutaml/model/services/transformer.rb', line 5 def call(value, rule, attribute) new(rule, attribute).call(value) end |
Instance Method Details
#call(value) ⇒ Object
17 18 19 20 21 |
# File 'lib/lutaml/model/services/transformer.rb', line 17 def call(value) transformation_methods.reduce(value) do |transformed_value, method| method.call(transformed_value) end end |