Class: Pubid::Oiml::Components::Code

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/pubid/oiml/components/code.rb

Overview

Code component for OIML identifiers.

Stays independent of Pubid::Components::Code because OIML uses number as the primary field (shared Code uses value). The shape is otherwise compatible; a future rename of numbervalue would let this become a subclass.

Instance Method Summary collapse

Instance Method Details

#render(context: nil) ⇒ Object



24
25
26
# File 'lib/pubid/oiml/components/code.rb', line 24

def render(context: nil)
  to_s
end

#to_sObject



17
18
19
20
21
22
# File 'lib/pubid/oiml/components/code.rb', line 17

def to_s
  result = number.to_s
  result += "-#{part}" if part
  result += "-#{subpart}" if subpart
  result
end