Class: Pubid::Iso::Components::Code
- Inherits:
-
Components::Code
- Object
- Lutaml::Model::Serializable
- Components::Code
- Pubid::Iso::Components::Code
- Defined in:
- lib/pubid/iso/components/code.rb
Overview
Code component for ISO identifiers.
Inherits value and parts from the shared Code; overrides rendering to join parts with “-” (ISO convention). Equality and hash are inherited from the shared Code (compare all fields).
Instance Method Summary collapse
Methods inherited from Components::Code
Instance Method Details
#render(context: nil) ⇒ Object
18 19 20 |
# File 'lib/pubid/iso/components/code.rb', line 18 def render(context: nil) to_s end |
#to_s ⇒ Object
12 13 14 15 16 |
# File 'lib/pubid/iso/components/code.rb', line 12 def to_s result = value.to_s result += parts.map { |p| "-#{p}" }.join if parts&.any? result end |