Class: Lutaml::Model::Type::Float

Inherits:
Value
  • Object
show all
Defined in:
lib/lutaml/model/type/float.rb

Instance Attribute Summary

Attributes inherited from Value

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Value

from_format, #initialize, #to_s

Constructor Details

This class inherits a constructor from Lutaml::Model::Type::Value

Class Method Details

.cast(value) ⇒ Object



5
6
7
8
9
# File 'lib/lutaml/model/type/float.rb', line 5

def self.cast(value)
  return nil if value.nil?

  value.to_f
end

.serialize(value) ⇒ Object



11
12
13
14
15
# File 'lib/lutaml/model/type/float.rb', line 11

def self.serialize(value)
  return nil if value.nil?

  cast(value)
end

Instance Method Details

#to_json(*_args) ⇒ Object



27
28
29
# File 'lib/lutaml/model/type/float.rb', line 27

def to_json(*_args)
  value
end

#to_xmlObject

Instance methods for specific formats xs:float format



19
20
21
# File 'lib/lutaml/model/type/float.rb', line 19

def to_xml
  value.to_s
end

#to_yamlObject



23
24
25
# File 'lib/lutaml/model/type/float.rb', line 23

def to_yaml
  value
end