Class: Termium::Source

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/termium/source.rb

Overview

For <source>

Constant Summary collapse

ISO_BIB_REGEX =
/\AISO-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze
ISOIEC_BIB_REGEX =
/\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze

Instance Method Summary collapse

Instance Method Details

#contentObject



17
18
19
20
21
22
23
24
25
# File 'lib/termium/source.rb', line 17

def content
  if (matches = details.match(ISOIEC_BIB_REGEX))
    "ISO/IEC #{matches[1]}:#{matches[2]}"
  elsif (matches = details.match(ISO_BIB_REGEX))
    "ISO #{matches[1]}:#{matches[2]}"
  else
    details
  end
end

#to_concept_sourceObject



27
28
29
30
31
32
33
# File 'lib/termium/source.rb', line 27

def to_concept_source
  Glossarist::ConceptSource.new({
                                  "type" => "lineage",
                                  "ref" => content,
                                  "status" => "identical",
                                })
end