Class: Lutaml::Model::ValueTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/value_transformer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#valueObject (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

Returns:

  • (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