Module: Pubid::Itu::Identifier

Extended by:
Core::Identifier
Defined in:
lib/pubid/itu/identifier.rb,
lib/pubid/itu/identifier/base.rb,
lib/pubid/itu/identifier/annex.rb,
lib/pubid/itu/identifier/addendum.rb,
lib/pubid/itu/identifier/appendix.rb,
lib/pubid/itu/identifier/question.rb,
lib/pubid/itu/identifier/amendment.rb,
lib/pubid/itu/identifier/resolution.rb,
lib/pubid/itu/identifier/supplement.rb,
lib/pubid/itu/identifier/corrigendum.rb,
lib/pubid/itu/identifier/contribution.rb,
lib/pubid/itu/identifier/recommendation.rb,
lib/pubid/itu/identifier/implementers_guide.rb,
lib/pubid/itu/identifier/special_publication.rb,
lib/pubid/itu/identifier/regulatory_publication.rb

Defined Under Namespace

Classes: Addendum, Amendment, Annex, Appendix, Base, Contribution, Corrigendum, ImplementersGuide, Question, Recommendation, RegulatoryPublication, Resolution, SpecialPublication, Supplement

Class Method Summary collapse

Class Method Details

.parse(*args) ⇒ Object

See Also:

  • Pubid::Identifier::Base.parse


7
8
9
# File 'lib/pubid/itu/identifier.rb', line 7

def parse(*args)
  Base.parse(*args)
end

.resolve_identifier(parameters = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pubid/itu/identifier.rb', line 11

def resolve_identifier(parameters = {})
  return Question.new(**parameters) if parameters[:series].to_s.match?(/^SG/) && !parameters[:type]

  return Resolution.new(**parameters) if parameters[:series].to_s == "R"

  return SpecialPublication.new(**parameters) if parameters[:series].to_s == "OB"

  if parameters[:regulatory_publication]
    return RegulatoryPublication.new(
      **parameters.reject { |k, _| k == :regulatory_publication }.merge(
        { series: parameters[:regulatory_publication] },
      ),
    )
  end

  return Recommendation.new(**parameters) if parameters[:series] && !parameters[:type]

  super
end