Class: Lutaml::Model::Type::Float
- Defined in:
- lib/lutaml/model/type/float.rb
Constant Summary
Constants inherited from Value
Instance Attribute Summary
Attributes inherited from Value
Class Method Summary collapse
- .cast(value, options = {}) ⇒ Object
-
.default_xsd_type ⇒ String
XSD type for Float.
- .serialize(value) ⇒ Object
Methods inherited from Value
format_type_serializer_for, from_format, #initialize, #initialized?, register_format_to_from_methods, register_format_type_serializer, #to_s
Methods included from Xml::Type::Configurable
Methods included from UninitializedClassGuard
Constructor Details
This class inherits a constructor from Lutaml::Model::Type::Value
Class Method Details
.cast(value, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lutaml/model/type/float.rb', line 7 def self.cast(value, = {}) return nil if value.nil? return value if Utils.uninitialized?(value) # Use identity check for EMPTY_OPTIONS (faster than .empty?) unless .equal?(EMPTY_OPTIONS) Model::Services::Type::Validator::Number.validate!(value, ) end value.to_f end |
.default_xsd_type ⇒ String
XSD type for Float
27 28 29 |
# File 'lib/lutaml/model/type/float.rb', line 27 def self.default_xsd_type "xs:float" end |
.serialize(value) ⇒ Object
18 19 20 21 22 |
# File 'lib/lutaml/model/type/float.rb', line 18 def self.serialize(value) return nil if value.nil? cast(value) end |