Class: Shale::Type::Value
- Inherits:
-
Object
- Object
- Shale::Type::Value
- Defined in:
- lib/shale/type/value.rb
Overview
Base class for all types
Class Method Summary collapse
-
.as_csv(value) ⇒ any
private
Convert value to form accepted by CSV document.
-
.as_hash(value) ⇒ any
private
Convert value to form accepted by Hash document.
-
.as_json(value) ⇒ any
private
Convert value to form accepted by JSON document.
-
.as_toml(value) ⇒ any
private
Convert value to form accepted by TOML document.
-
.as_xml(value, name, doc, cdata = false) ⇒ Object
private
Convert value to XML element.
-
.as_xml_value(value) ⇒ String
private
Convert value to form accepted by XML document.
-
.as_yaml(value) ⇒ any
private
Convert value to form accepted by YAML document.
-
.cast(value) ⇒ any
private
Cast raw value to a type.
-
.of_csv(value) ⇒ any
private
Extract value from CSV document.
-
.of_hash(value) ⇒ any
private
Extract value from Hash document.
-
.of_json(value) ⇒ any
private
Extract value from JSON document.
-
.of_toml(value) ⇒ any
private
Extract value from TOML document.
-
.of_xml(node) ⇒ String
private
Extract value from XML document.
-
.of_yaml(value) ⇒ any
private
Extract value from YAML document.
Class Method Details
.as_csv(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by CSV document
132 133 134 |
# File 'lib/shale/type/value.rb', line 132 def as_csv(value, **) value end |
.as_hash(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by Hash document
44 45 46 |
# File 'lib/shale/type/value.rb', line 44 def as_hash(value, **) value end |
.as_json(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by JSON document
66 67 68 |
# File 'lib/shale/type/value.rb', line 66 def as_json(value, **) value end |
.as_toml(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by TOML document
110 111 112 |
# File 'lib/shale/type/value.rb', line 110 def as_toml(value, **) value end |
.as_xml(value, name, doc, cdata = false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to XML element
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/shale/type/value.rb', line 166 def as_xml(value, name, doc, cdata = false, **) element = doc.create_element(name) if cdata doc.create_cdata(as_xml_value(value), element) else doc.add_text(element, as_xml_value(value)) end element end |
.as_xml_value(value) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by XML document
154 155 156 |
# File 'lib/shale/type/value.rb', line 154 def as_xml_value(value) value.to_s end |
.as_yaml(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert value to form accepted by YAML document
88 89 90 |
# File 'lib/shale/type/value.rb', line 88 def as_yaml(value, **) value end |
.cast(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Cast raw value to a type. Base form just returns whatever it receives
22 23 24 |
# File 'lib/shale/type/value.rb', line 22 def cast(value) value end |
.of_csv(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from CSV document
121 122 123 |
# File 'lib/shale/type/value.rb', line 121 def of_csv(value, **) value end |
.of_hash(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from Hash document
33 34 35 |
# File 'lib/shale/type/value.rb', line 33 def of_hash(value, **) value end |
.of_json(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from JSON document
55 56 57 |
# File 'lib/shale/type/value.rb', line 55 def of_json(value, **) value end |
.of_toml(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from TOML document
99 100 101 |
# File 'lib/shale/type/value.rb', line 99 def of_toml(value, **) value end |
.of_xml(node) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from XML document
143 144 145 |
# File 'lib/shale/type/value.rb', line 143 def of_xml(node, **) node.text end |
.of_yaml(value) ⇒ any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extract value from YAML document
77 78 79 |
# File 'lib/shale/type/value.rb', line 77 def of_yaml(value, **) value end |