Class: Lutaml::Model::ValueTransformer
- Inherits:
-
Object
- Object
- Lutaml::Model::ValueTransformer
- Defined in:
- lib/lutaml/model/value_transformer.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value = nil) ⇒ ValueTransformer
constructor
A new instance of ValueTransformer.
Constructor Details
#initialize(value = nil) ⇒ ValueTransformer
Returns a new instance of ValueTransformer.
8 9 10 |
# File 'lib/lutaml/model/value_transformer.rb', line 8 def initialize(value = nil) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/lutaml/model/value_transformer.rb', line 6 def value @value end |
Class Method Details
.can_transform?(method, format) ⇒ Boolean
20 21 22 |
# File 'lib/lutaml/model/value_transformer.rb', line 20 def self.can_transform?(method, format) method_defined?(:"#{method}_#{format}", false) end |
.from(value, format) ⇒ Object
12 13 14 |
# File 'lib/lutaml/model/value_transformer.rb', line 12 def self.from(value, format) new.send(:"from_#{format}", value) end |
.to(value, format) ⇒ Object
16 17 18 |
# File 'lib/lutaml/model/value_transformer.rb', line 16 def self.to(value, format) new(value).send(:"to_#{format}") end |