Class: Relaton::Iso::Type::Pubid
- Inherits:
-
Lutaml::Model::Type::Value
- Object
- Lutaml::Model::Type::Value
- Relaton::Iso::Type::Pubid
- Defined in:
- lib/relaton/iso/type/pubid.rb
Overview
Lutaml-model attribute type that preserves Pubid::Iso::Identifier
instances on the way in and stringifies them on the way out.
The default :string type calls .to_s during cast, which loses the
parsed structure and forces Docidentifier#content= to re-parse the
human-readable form. That round-trip can render dual-type strings
(e.g. "ISO/IS TR 17" from a TR pubid with stage 60.60) that the
pubid-iso parslet grammar can't capture cleanly, producing
Duplicate subtrees while merging result of ROOT warnings.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cast(value, _options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/relaton/iso/type/pubid.rb', line 14 def self.cast(value, = {}) return nil if value.nil? return value if Lutaml::Model::Utils.uninitialized?(value) value end |
.default_xsd_type ⇒ Object
44 45 46 |
# File 'lib/relaton/iso/type/pubid.rb', line 44 def self.default_xsd_type "xs:string" end |
.serialize(value) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/relaton/iso/type/pubid.rb', line 21 def self.serialize(value) return nil if value.nil? return value if Lutaml::Model::Utils.uninitialized?(value) value.to_s end |
Instance Method Details
#to_json(*_args) ⇒ Object
40 41 42 |
# File 'lib/relaton/iso/type/pubid.rb', line 40 def to_json(*_args) value.to_s end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/relaton/iso/type/pubid.rb', line 28 def to_s value.to_s end |
#to_xml ⇒ Object
36 37 38 |
# File 'lib/relaton/iso/type/pubid.rb', line 36 def to_xml value.to_s end |
#to_yaml ⇒ Object
32 33 34 |
# File 'lib/relaton/iso/type/pubid.rb', line 32 def to_yaml value.to_s end |