Class: Pubid::Iec::Scheme
Instance Attribute Summary
Attributes inherited from Scheme
#identifiers, #languages, #publishers, #stages, #supplement_identifiers, #types
Class Method Summary
collapse
Methods inherited from Scheme
#all_identifier_classes, #all_typed_stages, #configure, #identifier_class_index, #initialize, #locate_identifier_klass_by_type_code, #locate_typed_stage_by_abbr, #locate_typed_stage_by_harmonized_code, #locate_typed_stage_by_stage_code, #supplement_typed_stages, #typed_stage_index, #typed_stages
Constructor Details
This class inherits a constructor from Pubid::Scheme
Class Method Details
.locate_identifier_klass_by_type_code(type_code) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/pubid/iec/scheme.rb', line 56
def locate_identifier_klass_by_type_code(type_code)
identifier_klass = (identifiers + supplement_identifiers).detect do |klass|
klass.type[:key].to_s == type_code.to_s
end
unless identifier_klass
raise ArgumentError,
"Unknown type code: #{type_code}"
end
identifier_klass
end
|
.locate_typed_stage_by_abbr(abbr) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/pubid/iec/scheme.rb', line 41
def locate_typed_stage_by_abbr(abbr)
abbr = "" if abbr.nil?
typed_stage = (typed_stages + supplement_typed_stages).detect do |ts|
ts.abbr.include?(abbr)
end
unless typed_stage
raise ArgumentError,
"Unknown type abbreviation: '#{abbr}'"
end
typed_stage
end
|
.supplement_identifiers ⇒ Object
.supplement_typed_stages ⇒ Object
37
38
39
|
# File 'lib/pubid/iec/scheme.rb', line 37
def supplement_typed_stages
supplement_identifiers.flat_map { |klass| klass::TYPED_STAGES }
end
|
.typed_stages ⇒ Object
33
34
35
|
# File 'lib/pubid/iec/scheme.rb', line 33
def typed_stages
identifiers.flat_map { |klass| klass::TYPED_STAGES }
end
|