Class: Lutaml::Model::Type::String
- Defined in:
- lib/lutaml/model/type/string.rb
Instance Attribute Summary
Attributes inherited from Value
Class Method Summary collapse
- .cast(value) ⇒ Object
- .from_json(value) ⇒ Object
- .from_toml(value) ⇒ Object
- .from_xml(value) ⇒ Object
- .from_yaml(value) ⇒ Object
Instance Method Summary collapse
-
#to_json(*_args) ⇒ Object
JSON string.
-
#to_toml ⇒ Object
TOML string.
-
#to_xml ⇒ Object
xs:string format.
-
#to_yaml ⇒ Object
YAML string.
Methods inherited from Value
from_format, #initialize, serialize, #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/string.rb', line 5 def self.cast(value) return nil if value.nil? value.to_s end |
.from_json(value) ⇒ Object
35 36 37 |
# File 'lib/lutaml/model/type/string.rb', line 35 def self.from_json(value) cast(value) end |
.from_toml(value) ⇒ Object
43 44 45 |
# File 'lib/lutaml/model/type/string.rb', line 43 def self.from_toml(value) cast(value) end |
.from_xml(value) ⇒ Object
31 32 33 |
# File 'lib/lutaml/model/type/string.rb', line 31 def self.from_xml(value) cast(value) end |
.from_yaml(value) ⇒ Object
39 40 41 |
# File 'lib/lutaml/model/type/string.rb', line 39 def self.from_yaml(value) cast(value) end |
Instance Method Details
#to_json(*_args) ⇒ Object
JSON string
17 18 19 |
# File 'lib/lutaml/model/type/string.rb', line 17 def to_json(*_args) value end |
#to_toml ⇒ Object
TOML string
27 28 29 |
# File 'lib/lutaml/model/type/string.rb', line 27 def to_toml value&.to_s end |
#to_xml ⇒ Object
xs:string format
12 13 14 |
# File 'lib/lutaml/model/type/string.rb', line 12 def to_xml value&.to_s end |
#to_yaml ⇒ Object
YAML string
22 23 24 |
# File 'lib/lutaml/model/type/string.rb', line 22 def to_yaml value end |