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



31
32
33
# File 'lib/pubid/oiml/components/code.rb', line 31

def render(context: nil)
  to_s
end

#to_sObject



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

def to_s
  result = number.to_s
  result += "-#{part}" if part
  result += "-#{subpart}" if subpart
  result += "#{space_suffix ? ' ' : '-'}#{suffix}" if suffix
  result
end