pubid-iec 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pubid/iec/identifier/amendment.rb +22 -0
  3. data/lib/pubid/iec/identifier/base.rb +49 -3
  4. data/lib/pubid/iec/identifier/component_specification.rb +15 -0
  5. data/lib/pubid/iec/identifier/conformity_assessment.rb +15 -0
  6. data/lib/pubid/iec/identifier/corrigendum.rb +22 -0
  7. data/lib/pubid/iec/identifier/guide.rb +15 -0
  8. data/lib/pubid/iec/identifier/international_standard.rb +69 -0
  9. data/lib/pubid/iec/identifier/interpretation_sheet.rb +43 -0
  10. data/lib/pubid/iec/identifier/operational_document.rb +15 -0
  11. data/lib/pubid/iec/identifier/publicly_available_specification.rb +28 -0
  12. data/lib/pubid/iec/identifier/societal_technology_trend_report.rb +16 -0
  13. data/lib/pubid/iec/identifier/supplement.rb +18 -0
  14. data/lib/pubid/iec/identifier/systems_reference_document.rb +15 -0
  15. data/lib/pubid/iec/identifier/technical_report.rb +48 -0
  16. data/lib/pubid/iec/identifier/technical_specification.rb +48 -0
  17. data/lib/pubid/iec/identifier/technology_report.rb +15 -0
  18. data/lib/pubid/iec/identifier/test_report_form.rb +40 -0
  19. data/lib/pubid/iec/identifier/white_paper.rb +15 -0
  20. data/lib/pubid/iec/identifier/working_document.rb +39 -0
  21. data/lib/pubid/iec/parser.rb +17 -12
  22. data/lib/pubid/iec/renderer/amendment.rb +7 -0
  23. data/lib/pubid/iec/renderer/corrigendum.rb +7 -0
  24. data/lib/pubid/iec/renderer/pubid.rb +30 -7
  25. data/lib/pubid/iec/renderer/urn.rb +15 -2
  26. data/lib/pubid/iec/renderer/urn_amendment.rb +10 -0
  27. data/lib/pubid/iec/renderer/urn_corrigendum.rb +9 -0
  28. data/lib/pubid/iec/renderer/urn_supplement.rb +11 -0
  29. data/lib/pubid/iec/renderer/working_document.rb +11 -0
  30. data/lib/pubid/iec/renderer/working_document_urn.rb +16 -0
  31. data/lib/pubid/iec/transformer.rb +2 -2
  32. data/lib/pubid/iec/version.rb +1 -1
  33. data/lib/pubid/iec/working_document.rb +11 -0
  34. data/lib/pubid/iec/working_document_parser.rb +24 -0
  35. data/lib/pubid/iec.rb +37 -49
  36. data/stages.yaml +0 -29
  37. metadata +32 -8
  38. data/lib/pubid/iec/amendment.rb +0 -11
  39. data/lib/pubid/iec/corrigendum.rb +0 -11
  40. data/lib/pubid/iec/type.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 187ed5786efa96deff3b174e420e35459b0f26c36858e2fb36d7817bb9a131e0
4
- data.tar.gz: 050afef914f208fd2329dd6ab5ac6322133502f63ebfd87bcadcba9ac66766c6
3
+ metadata.gz: 521c15388c33bc8ce5118ea7e5d68a917882feeb638a452f2fa45006fc8fe04c
4
+ data.tar.gz: c18933a40936ece254eacc2f9882ce895c359bacc9cadf126abfaa9b154356f5
5
5
  SHA512:
6
- metadata.gz: e891ac1a9977ff42f712a8a178d84f5d4855fa806ceb22b7eb2affddc1bf948fb45d446b59d1cd9903f5e5b6b7944e59a16fd757ff932f37fac8928ab8b49122
7
- data.tar.gz: 361bd570bfc28dcf0d9a5496acd200af926329653e4364fb57697f10d11c641640595584c938952988d86b6879bf2a8259f3d10b1d2eb2e358579ff951d9e63d
6
+ metadata.gz: 138da54cbfd8cfae1776ad28487a4d30ca70150df77bbc8bbdaf555d6958dad7519c032b9241adc9a78cef5fee835e8cbbe88b1e34d841a003a46add8dd9812f
7
+ data.tar.gz: fea398c22600418dab178a50667961cc81b9b14e492976d797b34f931df45193eda531be158a74bb6e07a1aa62945b574fa7efd548fd4ff391284943b4e2d766
@@ -0,0 +1,22 @@
1
+ require_relative "../renderer/amendment"
2
+ require_relative "../renderer/urn_amendment"
3
+
4
+ module Pubid::Iec
5
+ module Identifier
6
+ class Amendment < Supplement
7
+ def_delegators 'Pubid::Iec::Identifier::Amendment', :type
8
+
9
+ def self.type
10
+ { key: :amd, title: "Amendment" }
11
+ end
12
+
13
+ def self.get_renderer_class
14
+ Renderer::Amendment
15
+ end
16
+
17
+ def urn
18
+ Renderer::UrnAmendment.new(get_params).render
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,25 +1,39 @@
1
+ require "forwardable"
2
+
1
3
  module Pubid::Iec
2
4
  class Base < Pubid::Core::Identifier::Base
3
5
 
4
6
  attr_accessor :vap, :database, :fragment, :version, :decision_sheet,
5
7
  :conjuction_part, :part_version, :trf_publisher,
6
- :trf_series, :trf_version, :test_type
8
+ :trf_series, :trf_version, :test_type, :month, :day
9
+
10
+ extend Forwardable
7
11
 
8
12
  # @param stage [String] stage eg. "PWI", "PNW"
9
13
  def initialize(publisher: "IEC", stage: nil, vap: nil, database: nil,
10
14
  fragment: nil, version: nil, decision_sheet: nil,
11
15
  conjuction_part: nil, part_version: nil, trf_publisher: nil,
12
16
  trf_series: nil, trf_version: nil, test_type: nil,
13
- edition: nil, type: nil, **args)
17
+ edition: nil, type: nil, month: nil, day: nil,
18
+ language: nil, **args)
14
19
  # @stage = stage.to_s if stage
15
20
  # @stage = Stage.parse(stage) if stage
16
21
 
17
22
  if stage
18
23
  if stage.is_a?(Stage)
19
24
  @stage = stage
25
+ @typed_stage = resolve_typed_stage(@stage.harmonized_code) unless @stage.abbr
26
+ elsif self.class.has_typed_stage?(stage)
27
+ @typed_stage, @stage = self.class.find_typed_stage(stage)
20
28
  else
21
29
  @stage = Identifier.parse_stage(stage)
30
+ # resolve typed stage when harmonized code provided as stage
31
+ # or stage abbreviation was not resolved
32
+ if /\A[\d.]+\z/.match?(stage) || @stage.empty_abbr?(with_prf: true)
33
+ @typed_stage = self.class.resolve_typed_stage(@stage.harmonized_code)
34
+ end
22
35
  end
36
+ @typed_stage = self.class::TYPED_STAGES[@typed_stage][:abbr] if @typed_stage
23
37
  end
24
38
 
25
39
  @vap = vap.to_s if vap
@@ -34,7 +48,9 @@ module Pubid::Iec
34
48
  @trf_version = trf_version.to_s if trf_version
35
49
  @test_type = test_type if test_type
36
50
  @edition = edition.to_s if edition
37
- @type = Identifier.build_type(type) if type
51
+ @month = month if month
52
+ @day = day if day
53
+ @language = language if language
38
54
 
39
55
  super(**args.merge(publisher: publisher))
40
56
  end
@@ -43,7 +59,33 @@ module Pubid::Iec
43
59
  Renderer::Urn.new(get_params).render
44
60
  end
45
61
 
62
+ def to_s(with_edition_month_date: false)
63
+ self.class.get_renderer_class.new(get_params).render(with_edition_month_date: with_edition_month_date)
64
+ end
65
+
46
66
  class << self
67
+ def has_type?(type)
68
+ return type == self.type[:key] if type.is_a?(Symbol)
69
+
70
+ if self.type.key?(:short)
71
+ self.type[:short].is_a?(Array) ? self.type[:short].include?(type) : self.type[:short] == type
72
+ else
73
+ type.to_s.downcase.to_sym == self.type[:key]
74
+ end
75
+ end
76
+
77
+ def transform_hash(params)
78
+ params.map do |k, v|
79
+ get_transformer_class.new.apply(k => v.is_a?(Hash) ? transform_hash(v) : v)
80
+ end.inject({}, :merge)
81
+ end
82
+
83
+ def transform(params)
84
+ identifier_params = transform_hash(params)
85
+
86
+ Identifier.create(**identifier_params)
87
+ end
88
+
47
89
  def get_amendment_class
48
90
  Amendment
49
91
  end
@@ -67,6 +109,10 @@ module Pubid::Iec
67
109
  def get_update_codes
68
110
  UPDATE_CODES
69
111
  end
112
+
113
+ def get_identifier
114
+ Identifier
115
+ end
70
116
  end
71
117
 
72
118
  def database
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class ComponentSpecification < Base
4
+ def_delegators 'Pubid::Iec::Identifier::ComponentSpecification', :type
5
+
6
+ def self.type
7
+ { key: :cs, title: "Component Specification", short: "CS" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "CS")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class ConformityAssessment < Base
4
+ def_delegators 'Pubid::Iec::Identifier::ConformityAssessment', :type
5
+
6
+ def self.type
7
+ { key: :ca, title: "Conformity Assessment", short: "CA" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "CA")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "../renderer/corrigendum"
2
+ require_relative "../renderer/urn_corrigendum"
3
+
4
+ module Pubid::Iec
5
+ module Identifier
6
+ class Corrigendum < Supplement
7
+ def_delegators 'Pubid::Iec::Identifier::Corrigendum', :type
8
+
9
+ def self.type
10
+ { key: :cor, title: "Corrigendum" }
11
+ end
12
+
13
+ def self.get_renderer_class
14
+ Renderer::Corrigendum
15
+ end
16
+
17
+ def urn
18
+ Renderer::UrnCorrigendum.new(get_params).render
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class Guide < Base
4
+ def_delegators 'Pubid::Iec::Identifier::Guide', :type
5
+
6
+ def self.type
7
+ { key: :guide, title: "Guide", short: %w[Guide GUIDE] }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "Guide")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,69 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class InternationalStandard < Base
4
+ def_delegators 'Pubid::Iec::Identifier::InternationalStandard', :type
5
+
6
+ TYPED_STAGES = {
7
+ afdis: {
8
+ abbr: "AFDIS",
9
+ name: "Approved for FDIS",
10
+ harmonized_stages: %w[40.99],
11
+ },
12
+ ccdv: {
13
+ abbr: "CCDV",
14
+ name: "Draft circulated as CDV",
15
+ harmonized_stages: %w[40.20],
16
+ },
17
+ cdvm: {
18
+ abbr: "CDVM",
19
+ name: "Rejected CDV to be discussed at a meeting",
20
+ harmonized_stages: %w[40.91],
21
+ },
22
+ cfdis: {
23
+ abbr: "CFDIS",
24
+ name: "Draft circulated as FDIS",
25
+ harmonized_stages: %w[50.20],
26
+ },
27
+ decfdis: {
28
+ abbr: "DECFDIS",
29
+ name: "FDIS at editing check",
30
+ harmonized_stages: %w[50.00],
31
+ },
32
+ ncdv: {
33
+ abbr: "NCDV",
34
+ name: "CDV rejected",
35
+ harmonized_stages: %w[40.91],
36
+ },
37
+ nfdis: {
38
+ abbr: "NFDIS",
39
+ name: "FDIS rejected",
40
+ harmonized_stages: %w[50.92],
41
+ },
42
+ prvc: {
43
+ abbr: "PRVC",
44
+ name: "Preparation of RVC",
45
+ harmonized_stages: %w[40.60],
46
+ },
47
+ prvd: {
48
+ abbr: "PRVD",
49
+ name: "Preparation of RVD",
50
+ harmonized_stages: %w[50.60],
51
+ },
52
+ rfdis: {
53
+ abbr: "RFDIS",
54
+ name: "FDIS received and registered",
55
+ harmonized_stages: %w[50.00],
56
+ },
57
+ tcdv: {
58
+ abbr: "TCDV",
59
+ name: "Translation of CDV",
60
+ harmonized_stages: %w[40.00],
61
+ },
62
+ }.freeze
63
+
64
+ def self.type
65
+ { key: :is, title: "International Standard", short: "IS" }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,43 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class InterpretationSheet < Base
4
+ def_delegators 'Pubid::Iec::Identifier::InterpretationSheet', :type
5
+
6
+ TYPED_STAGES = {
7
+ cdish: {
8
+ abbr: "CDISH",
9
+ name: "Draft circulated as DISH",
10
+ harmonized_stages: %w[50.20],
11
+ },
12
+ decdish: {
13
+ abbr: "DECDISH",
14
+ name: "DISH at editing check",
15
+ harmonized_stages: %w[50.00],
16
+ },
17
+ prvdish: {
18
+ abbr: "PRVDISH",
19
+ name: "Preparation of RVDISH",
20
+ harmonized_stages: %w[50.60],
21
+ },
22
+ rdish: {
23
+ abbr: "RDISH",
24
+ name: "DISH received and registered",
25
+ harmonized_stages: %w[50.00],
26
+ },
27
+ tdish: {
28
+ abbr: "TDISH",
29
+ name: "Translation of DISH",
30
+ harmonized_stages: %w[50.00],
31
+ },
32
+ }.freeze
33
+
34
+ def self.type
35
+ { key: :ish, title: "InterpretationSheet", short: "ISH" }
36
+ end
37
+
38
+ def get_params
39
+ super.merge(type: "ISH")
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class OperationalDocument < Base
4
+ def_delegators 'Pubid::Iec::Identifier::OperationalDocument', :type
5
+
6
+ def self.type
7
+ { key: :od, title: "Operational Document", short: "OD" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "OD")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class PubliclyAvailableSpecification < Base
4
+ def_delegators 'Pubid::Iec::Identifier::PubliclyAvailableSpecification', :type
5
+
6
+ TYPED_STAGES = {
7
+ cdpas: {
8
+ abbr: "CDPAS",
9
+ name: "Draft circulated as DPAS",
10
+ harmonized_stages: %w[50.20],
11
+ },
12
+ PRVDPAS: {
13
+ abbr: "PRVDPAS",
14
+ name: "Preparation of RVDPAS",
15
+ harmonized_stages: %w[50.60],
16
+ }
17
+ }.freeze
18
+
19
+ def self.type
20
+ { key: :pas, title: "Publicly Available Specification", short: "PAS" }
21
+ end
22
+
23
+ def get_params
24
+ super.merge(type: "PAS")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ module Pubid::Iec
3
+ module Identifier
4
+ class SocietalTechnologyTrendReport < Base
5
+ def_delegators 'Pubid::Iec::Identifier::SocietalTechnologyTrendReport', :type
6
+
7
+ def self.type
8
+ { key: :sttr, title: "Societal and Technology Trend Report", short: "Trend Report" }
9
+ end
10
+
11
+ def get_params
12
+ super.merge(type: "Trend Report")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class Supplement < Base
4
+ def initialize(number:, year: nil)
5
+ @number = number ? number.to_i : 1
6
+ @year = year&.to_i
7
+ end
8
+
9
+ def <=>(other)
10
+ return 0 if year.nil? && other.year
11
+
12
+ return year <=> other.year if number == other.number
13
+
14
+ (number <=> other.number) || year <=> other.year
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class SystemsReferenceDocument < Base
4
+ def_delegators 'Pubid::Iec::Identifier::SystemsReferenceDocument', :type
5
+
6
+ def self.type
7
+ { key: :srd, title: "Systems Reference Document", short: "SRD" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "SRD")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,48 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class TechnicalReport < Base
4
+ def_delegators 'Pubid::Iec::Identifier::TechnicalReport', :type
5
+
6
+ TYPED_STAGES = {
7
+ adtr: {
8
+ abbr: "ADTR",
9
+ name: "Approved for DTR",
10
+ harmonized_stages: %w[40.99],
11
+ },
12
+ cdtr: {
13
+ abbr: "CDTR",
14
+ name: "Draft circulated as DTR",
15
+ harmonized_stages: %w[50.20],
16
+ },
17
+ dtrm: {
18
+ abbr: "DTRM",
19
+ name: "Rejected DTR to be discussed at meeting",
20
+ harmonized_stages: %w[50.92],
21
+ },
22
+ ndtr: {
23
+ abbr: "NDTR",
24
+ name: "DTR rejected",
25
+ harmonized_stages: %w[50.92],
26
+ },
27
+ prvdtr: {
28
+ abbr: "PRVDTR",
29
+ name: "Preparation of RVDTR",
30
+ harmonized_stages: %w[50.60]
31
+ },
32
+ tdtr: {
33
+ abbr: "TDTR",
34
+ name: "Translation of DTR",
35
+ harmonized_stages: %w[50.00]
36
+ }
37
+ }.freeze
38
+
39
+ def self.type
40
+ { key: :tr, title: "Technical Report", short: "TR" }
41
+ end
42
+
43
+ def get_params
44
+ super.merge(type: "TR")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class TechnicalSpecification < Base
4
+ TYPED_STAGES = {
5
+ adts: {
6
+ abbr: "ADTS",
7
+ name: "Approved for DTS",
8
+ harmonized_stages: %w[40.99],
9
+ },
10
+ cdts: {
11
+ abbr: "CDTS",
12
+ name: "Draft circulated as DTS",
13
+ harmonized_stages: %w[50.20],
14
+ },
15
+ dtsm: {
16
+ abbr: "DTSM",
17
+ name: "Rejected DTS to be discussed at meeting",
18
+ harmonized_stages: %w[50.92],
19
+ },
20
+ ndts: {
21
+ abbr: "NDTS",
22
+ name: "DTS rejected",
23
+ harmonized_stages: %w[50.92],
24
+ },
25
+ prvdts: {
26
+ abbr: "PRVDTS",
27
+ name: "Preparation of RVDTS",
28
+ harmonized_stages: %w[50.60],
29
+ },
30
+ tdts: {
31
+ abbr: "TDTS",
32
+ name: "Translation of DTS",
33
+ harmonized_stages: %w[50.00],
34
+ },
35
+ }.freeze
36
+
37
+ def_delegators 'Pubid::Iec::Identifier::TechnicalSpecification', :type
38
+
39
+ def self.type
40
+ { key: :ts, title: "Technical Specification", short: "TS" }
41
+ end
42
+
43
+ def get_params
44
+ super.merge(type: "TS")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class TechnologyReport < Base
4
+ def_delegators 'Pubid::Iec::Identifier::TechnologyReport', :type
5
+
6
+ def self.type
7
+ { key: :tec, title: "Technology Report", short: "Technology Report" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "Technology Report")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class TestReportForm < Base
4
+
5
+ attr_accessor :version, :decision_sheet,
6
+ :conjuction_part, :part_version, :trf_publisher,
7
+ :trf_series, :trf_version, :test_type
8
+
9
+ def initialize(publisher: "IEC", decision_sheet: nil, trf_publisher: nil,
10
+ trf_series: nil, trf_version: nil, test_type: nil,
11
+ **args)
12
+ @decision_sheet = decision_sheet if decision_sheet
13
+ @trf_publisher = trf_publisher.to_s if trf_publisher
14
+ @trf_series = trf_series if trf_series
15
+ @trf_version = trf_version.to_s if trf_version
16
+ @test_type = test_type if test_type
17
+
18
+ super(**args.merge(publisher: publisher))
19
+ end
20
+
21
+ def self.type
22
+ { key: :trf, title: "Test Report Form", short: "TRF" }
23
+ end
24
+
25
+ def urn
26
+ Renderer::TrfUrn.new(get_params).render
27
+ end
28
+
29
+ class << self
30
+ def get_parser_class
31
+ TrfParser
32
+ end
33
+
34
+ def get_renderer_class
35
+ Renderer::TrfPubid
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,15 @@
1
+ module Pubid::Iec
2
+ module Identifier
3
+ class WritePaper < Base
4
+ def_delegators 'Pubid::Iec::Identifier::WritePaper', :type
5
+
6
+ def self.type
7
+ { key: :wp, title: "Write Paper", short: "White Paper" }
8
+ end
9
+
10
+ def get_params
11
+ super.merge(type: "White Paper")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ require "forwardable"
2
+
3
+ module Pubid::Iec
4
+ module Identifier
5
+ class WorkingDocument < Pubid::Core::Identifier::Base
6
+ STAGES = %w[ACDV ACD ADTR ADTS AFDIS APUB BPUB CAN CDM CCDV CDISH CDVM
7
+ CFDIS CDPAS CDTR CDTS DTRM DTSM DECDISH DECFDIS DECPUB
8
+ DELPUB DEL NCDV NDTR NDTS NFDIS PCC PNW PPUB PRVC PRVDISH
9
+ PRVDPAS PRVDTR PRVDTS PRVD PRVN PWI RDISH RFDIS RPUB TCDV TDISH
10
+ TDTR TDTS TPUB WPUB AC CC CDV CD DA DV DC DISH DL DPAS DTR
11
+ DTS FDIS INF MTG NP QP Q RM RQ RR RVC RVDISH RVDTR RVDTS RVD
12
+ RVN RV R SBP].freeze
13
+
14
+ extend Forwardable
15
+
16
+ attr_accessor :technical_committee
17
+
18
+ def initialize(publisher: "IEC", technical_committee: nil, **args)
19
+ super(**args.merge(publisher: publisher))
20
+
21
+ @technical_committee = technical_committee
22
+ end
23
+
24
+ def urn
25
+ Renderer::WorkingDocumentUrn.new(get_params).render
26
+ end
27
+
28
+ class << self
29
+ def get_parser_class
30
+ WorkingDocumentParser
31
+ end
32
+
33
+ def get_renderer_class
34
+ Renderer::WorkingDocument
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -4,7 +4,7 @@ module Pubid::Iec
4
4
  class Parser < Pubid::Core::Parser
5
5
  rule(:organization) do
6
6
  str("IECEE") | str("IECEx") | str("IECQ") | str("IEC") | str("ISO") |
7
- str("IEEE") | str("CISPR")
7
+ str("IEEE") | str("CISPR") | str("ASTM")
8
8
  end
9
9
 
10
10
  rule(:stage) do
@@ -12,10 +12,7 @@ module Pubid::Iec
12
12
  end
13
13
 
14
14
  rule(:type) do
15
- (str("IS") | str("TS") | str("TR") | str("PAS") | str("SRD") |
16
- str("TEC") | str("STTR") | str("WP") | str("Guide") | str("GUIDE") | str("OD") |
17
- str("CS") | str("CA")
18
- ).as(:type)
15
+ array_to_str(Identifier.config.types.map { |type| type.type[:short] }.flatten.compact).as(:type)
19
16
  end
20
17
 
21
18
  rule(:part) do
@@ -33,7 +30,7 @@ module Pubid::Iec
33
30
 
34
31
  rule(:amendment) do
35
32
  ((str("/") | str("+") | space).maybe >>
36
- str("AMD") >>
33
+ (str("AMD") | str("A")) >>
37
34
  digits.as(:number) >>
38
35
  (str(":") >> digits.as(:year)).maybe).as(:amendments)
39
36
  end
@@ -43,9 +40,9 @@ module Pubid::Iec
43
40
  end
44
41
 
45
42
  rule(:corrigendum) do
46
- ((str("/") | space).maybe >>
43
+ ((str("/") | str(" + ") | space).maybe >>
47
44
  str("COR") >>
48
- digits.as(:number) >>
45
+ digits.as(:number).maybe >>
49
46
  (str(":") >> digits.as(:year)).maybe).as(:corrigendums)
50
47
  end
51
48
 
@@ -55,8 +52,8 @@ module Pubid::Iec
55
52
 
56
53
  rule(:number) do
57
54
  (digits | str("SYMBOL") | str("SYCSMARTENERGY") | str("SyCLVDC") |
58
- str("SYCLVDC") | str("SyCCOMM") | str("SyCAAL") | str("VIM")) >>
59
- match("[A-Z]").maybe
55
+ str("SYCLVDC") | str("SyCCOMM") | str("SyCAAL") | str("VIM") | match("[A-Za-z0-9 ]").repeat) >>
56
+ ((str(":") >> match("[A-Z]").repeat(1)) | match("[A-Z]")).maybe
60
57
  end
61
58
 
62
59
  rule(:std_document_body) do
@@ -65,7 +62,8 @@ module Pubid::Iec
65
62
  edition.maybe >>
66
63
  part.maybe >>
67
64
  conjuction_part.maybe >>
68
- (space? >> str(":") >> year).maybe >>
65
+ (space? >> str(":") >> year >> (str("-") >> month_digits.as(:month) >>
66
+ (str("-") >> day_digits.as(:day)).maybe).maybe).maybe >>
69
67
  ((amendment >> corrigendum.maybe) | corrigendum).repeat >>
70
68
  fragment.maybe
71
69
  end
@@ -79,12 +77,19 @@ module Pubid::Iec
79
77
  space >> str("DB").as(:database)
80
78
  end
81
79
 
80
+ rule(:language) do
81
+ str("(") >> (
82
+ (match["a-z"].repeat(1).as(:language) >> str("-").maybe).repeat(1)
83
+ ) >> str(")")
84
+ end
85
+
82
86
  rule(:identifier) do
83
87
  (originator.maybe >> (space.maybe >> stage.as(:stage)).maybe >> (space | str("/")) >>
84
88
  std_document_body >>
85
89
  vap.maybe >> database.maybe >>
86
90
  edition.maybe >>
87
- (str(":") >> year).maybe)
91
+ (str(":") >> year).maybe >>
92
+ language.maybe)
88
93
  end
89
94
 
90
95
  rule(:root) { identifier }
@@ -0,0 +1,7 @@
1
+ module Pubid::Iec::Renderer
2
+ class Amendment < Pubid
3
+ def render_identifier(params)
4
+ "AMD%{number}%{year}" % params
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Pubid::Iec::Renderer
2
+ class Corrigendum < Pubid
3
+ def render_identifier(params)
4
+ "COR%{number}%{year}" % params
5
+ end
6
+ end
7
+ end
@@ -1,12 +1,17 @@
1
1
  module Pubid::Iec::Renderer
2
2
  class Pubid < Pubid::Core::Renderer::Base
3
3
  def render_identifier(params)
4
- "%{publisher}%{type}%{stage} %{number}%{part}%{conjuction_part}"\
4
+ "%{publisher}%{type}%{typed_stage}%{stage} %{number}%{part}%{conjuction_part}"\
5
5
  "%{part_version}%{version}%{iteration}"\
6
- "%{year}%{amendments}%{corrigendums}%{fragment}%{vap}%{edition}%{language}%{database}" % params
6
+ "%{year}%{month}%{day}%{amendments}%{corrigendums}%{fragment}%{vap}%{edition}%{database}" % params
7
+ end
8
+ def render_typed_stage(typed_stage, _opts, _params)
9
+ " #{typed_stage}"
7
10
  end
8
11
 
9
12
  def render_type(type, _opts, _params)
13
+ return if params[:typed_stage]
14
+
10
15
  " #{type}"
11
16
  end
12
17
 
@@ -14,7 +19,9 @@ module Pubid::Iec::Renderer
14
19
  " #{vap}"
15
20
  end
16
21
 
17
- def render_stage(stage, _opts, _params)
22
+ def render_stage(stage, _opts, params)
23
+ return if params[:typed_stage]
24
+
18
25
  " #{stage}"
19
26
  end
20
27
 
@@ -30,12 +37,12 @@ module Pubid::Iec::Renderer
30
37
  params[:vap] == "CSV" && "+" || "/"
31
38
  end
32
39
 
33
- def render_amendments(amendments, _opts, params)
34
- supplement_prefix(params) + super
40
+ def render_amendments(amendments, _opts, _params)
41
+ supplement_prefix(params) + amendments.sort.map(&:to_s).join("+")
35
42
  end
36
43
 
37
- def render_corrigendums(corrigendums, _opts, params)
38
- supplement_prefix(params) + super
44
+ def render_corrigendums(corrigendums, _opts, _params)
45
+ supplement_prefix(params) + corrigendums.sort.map(&:to_s).join("+")
39
46
  end
40
47
 
41
48
  def render_version(version, _opts, params)
@@ -63,5 +70,21 @@ module Pubid::Iec::Renderer
63
70
  "#{conjunction_symbol}#{conjuction_parts}"
64
71
  end
65
72
  end
73
+
74
+ def render_month(month, opts, _params)
75
+ "-#{month}" if opts[:with_edition_month_date]
76
+ end
77
+
78
+ def render_day(day, opts, _params)
79
+ "-#{day}" if opts[:with_edition_month_date]
80
+ end
81
+
82
+ def render_language(language, opts, _params)
83
+ if language.is_a?(Array)
84
+ "(#{language.map(&:to_s).sort.join('-')})"
85
+ else
86
+ "(#{language})"
87
+ end
88
+ end
66
89
  end
67
90
  end
@@ -56,7 +56,7 @@ module Pubid::Iec::Renderer
56
56
  "urn:iec:std:%{publisher}%{copublisher}%{type}:%{number}"\
57
57
  "%{part}%{conjuction_part}%{year}%{stage}%{vap}"\
58
58
  "%{urn_stage}%{corrigendum_stage}%{iteration}%{version}%{part_version}"\
59
- "%{edition}%{amendments}%{corrigendums}%{fragment}%{language}" % params
59
+ "%{edition}%{amendments}%{corrigendums}%{fragment}" % params
60
60
  end
61
61
 
62
62
  def render_number(number, _opts, _params)
@@ -92,7 +92,20 @@ module Pubid::Iec::Renderer
92
92
  end
93
93
 
94
94
  def render_type(type, _, _)
95
- ":#{type.type.to_s}"
95
+ ":#{type.downcase}"
96
96
  end
97
+
98
+ def render_amendments(amendments, _opts, _params)
99
+ amendments&.map(&:urn)&.join || ""
100
+ end
101
+
102
+ def render_corrigendums(corrigendums, _opts, _params)
103
+ corrigendums&.map(&:urn)&.join || ""
104
+ end
105
+
106
+ def render_language(language, _opts, _params)
107
+ ":" + (language.is_a?(Array) ? language.join("-") : language)
108
+ end
109
+
97
110
  end
98
111
  end
@@ -0,0 +1,10 @@
1
+ require_relative "urn_supplement"
2
+
3
+ module Pubid::Iec::Renderer
4
+ class UrnAmendment < UrnSupplement
5
+ def render_identifier(params)
6
+ ":amd%{year}%{number}" % params
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ require_relative "urn_supplement"
2
+
3
+ module Pubid::Iec::Renderer
4
+ class UrnCorrigendum < UrnSupplement
5
+ def render_identifier(params)
6
+ ":cor%{year}%{number}" % params
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Pubid::Iec::Renderer
2
+ class UrnSupplement < ::Pubid::Core::Renderer::Urn
3
+ def render_number(number, _opts, params)
4
+ if params[:year]
5
+ ":v#{number}"
6
+ else
7
+ ":#{number}:v1"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Pubid::Iec::Renderer
2
+ class WorkingDocument < Pubid
3
+ def render_identifier(params)
4
+ "%{technical_committee}/%{number}%{stage}" % params
5
+ end
6
+
7
+ def render_stage(stage, _opts, _params)
8
+ "/#{stage}"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module Pubid::Iec::Renderer
2
+ class WorkingDocumentUrn < Urn
3
+
4
+ def render_identifier(params)
5
+ "urn:iec:working-document:%{technical_committee}:%{number}%{stage}" % params
6
+ end
7
+
8
+ def render_technical_committee(technical_committee, _opts, _params)
9
+ technical_committee.to_s.gsub("/", "-").downcase
10
+ end
11
+
12
+ def render_stage(stage, _opts, _params)
13
+ ":stage-#{stage.to_s.downcase}"
14
+ end
15
+ end
16
+ end
@@ -10,11 +10,11 @@ module Pubid::Iec
10
10
 
11
11
  class << self
12
12
  def get_amendment_class
13
- Amendment
13
+ Identifier::Amendment
14
14
  end
15
15
 
16
16
  def get_corrigendum_class
17
- Corrigendum
17
+ Identifier::Corrigendum
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Iec
3
- VERSION = "0.2.2".freeze
3
+ VERSION = "0.2.4".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ module Pubid::Iec
2
+ module WorkingDocument
3
+ class << self
4
+ include Pubid::Core::Identifier
5
+
6
+ def parse(*args)
7
+ Identifier::WorkingDocument.parse(*args)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ require "pubid-core"
2
+
3
+ module Pubid::Iec
4
+ class WorkingDocumentParser < Pubid::Core::Parser
5
+ rule(:stage) do
6
+ array_to_str(Identifier::WorkingDocument::STAGES).as(:stage)
7
+ end
8
+
9
+ rule(:technical_committee) do
10
+ ((str("CIS/") >> match("[A-Z]")) |
11
+ (match("[A-Za-z0-9-]").repeat(1))).as(:technical_committee)
12
+ end
13
+
14
+ rule(:number) do
15
+ (digits >> match("[A-Z]").maybe >> str("(F)").maybe).as(:number)
16
+ end
17
+
18
+ rule(:identifier) do
19
+ technical_committee >> str("/") >> number >> (str("/") >> stage).maybe
20
+ end
21
+
22
+ rule(:root) { identifier }
23
+ end
24
+ end
data/lib/pubid/iec.rb CHANGED
@@ -10,68 +10,56 @@ end
10
10
  require "pubid-core"
11
11
  require_relative "iec/errors"
12
12
  require_relative "iec/stage"
13
- # require_relative "iec/type"
14
13
  require_relative "iec/parser"
15
14
  require_relative "iec/trf_parser"
16
- require_relative "iec/amendment"
17
- require_relative "iec/corrigendum"
18
15
  require_relative "iec/renderer/pubid"
19
16
  require_relative "iec/renderer/trf_pubid"
20
17
  require_relative "iec/renderer/urn"
21
18
  require_relative "iec/renderer/trf_urn"
19
+ require_relative "iec/renderer/working_document"
20
+ require_relative "iec/renderer/working_document_urn"
22
21
  require_relative "iec/transformer"
23
22
  require_relative "iec/identifier/base"
23
+ require_relative "iec/identifier/international_standard"
24
+ require_relative "iec/identifier/technical_report"
25
+ require_relative "iec/identifier/technical_specification"
26
+ require_relative "iec/identifier/publicly_available_specification"
27
+ require_relative "iec/identifier/guide"
28
+ require_relative "iec/identifier/operational_document"
29
+ require_relative "iec/identifier/component_specification"
30
+ require_relative "iec/identifier/systems_reference_document"
31
+ require_relative "iec/identifier/conformity_assessment"
32
+ require_relative "iec/identifier/test_report_form"
33
+ require_relative "iec/identifier/supplement"
34
+ require_relative "iec/identifier/amendment"
35
+ require_relative "iec/identifier/corrigendum"
36
+ require_relative "iec/identifier/white_paper"
37
+ require_relative "iec/identifier/technology_report"
38
+ require_relative "iec/identifier/societal_technology_trend_report"
39
+ require_relative "iec/identifier/interpretation_sheet"
40
+ require_relative "iec/working_document_parser"
41
+ require_relative "iec/identifier/working_document"
24
42
  require_relative "iec/trf_identifier"
25
43
  require_relative "iec/identifier"
44
+ require_relative "iec/working_document"
26
45
 
27
46
  config = Pubid::Core::Configuration.new
28
47
  config.stages = YAML.load_file(File.join(File.dirname(__FILE__), "../../stages.yaml"))
29
48
  config.stage_class = Pubid::Iec::Stage
30
- config.type_names = { is: {
31
- long: "International Standard",
32
- short: "IS",
33
- },
34
- ts: {
35
- long: "Technical Specification",
36
- short: "TS",
37
- },
38
- tr: {
39
- long: "Technical Report",
40
- short: "TR",
41
- },
42
- pas: {
43
- long: "Publicly Available Specification",
44
- short: "PAS",
45
- },
46
- srd: {
47
- short: "SRD",
48
- },
49
- tec: {
50
- short: "TEC",
51
- },
52
- sttr: {
53
- short: "STTR",
54
- },
55
- wp: {
56
- short: "WP",
57
- },
58
- guide: {
59
- long: "Guide",
60
- short: "Guide",
61
- },
62
- od: {
63
- short: "OD",
64
- },
65
- cs: {
66
- short: "CS",
67
- },
68
- ca: {
69
- short: "CA",
70
- },
71
- trf: {
72
- long: "Test Report Form",
73
- short: "TRF",
74
- }
49
+ config.default_type = Pubid::Iec::Identifier::InternationalStandard
50
+ config.types = [Pubid::Iec::Identifier::InternationalStandard,
51
+ Pubid::Iec::Identifier::TechnicalReport,
52
+ Pubid::Iec::Identifier::TechnicalSpecification,
53
+ Pubid::Iec::Identifier::PubliclyAvailableSpecification,
54
+ Pubid::Iec::Identifier::Guide,
55
+ Pubid::Iec::Identifier::OperationalDocument,
56
+ Pubid::Iec::Identifier::ComponentSpecification,
57
+ Pubid::Iec::Identifier::SystemsReferenceDocument,
58
+ Pubid::Iec::Identifier::ConformityAssessment,
59
+ Pubid::Iec::Identifier::TestReportForm,
60
+ Pubid::Iec::Identifier::WritePaper,
61
+ Pubid::Iec::Identifier::TechnologyReport,
62
+ Pubid::Iec::Identifier::SocietalTechnologyTrendReport,
63
+ Pubid::Iec::Identifier::InterpretationSheet]
75
64
 
76
- }.freeze
77
65
  Pubid::Iec::Identifier.set_config(config)
data/stages.yaml CHANGED
@@ -1,52 +1,23 @@
1
1
  abbreviations:
2
2
  ACD: "20.99"
3
3
  ACDV: "30.99"
4
- ADTR: "40.99"
5
- ADTS: "40.99"
6
- AFDIS: "40.99"
7
4
  APUB: "50.99"
8
5
  BPUB: "60.00"
9
6
  CAN: "30.98"
10
- CCDV: "40.20"
11
7
  CD: "30.20"
12
- CDISH: "50.20"
13
8
  CDM: "30.60"
14
- CDPAS: "50.20"
15
- CDTR: "50.20"
16
- CDTS: "50.20"
17
- CDVM: "40.91"
18
- CFDIS: "50.20"
19
- DECDISH: "50.00"
20
- DECFDIS: "50.00"
21
9
  DECPUB: "60.00"
22
10
  DEL: "10.98"
23
11
  DELPUB: "99.60"
24
- DTRM: "50.92"
25
- DTSM: "50.92"
26
12
  MERGED: "30.97"
27
- NCDV: "40.91"
28
- NDTR: "50.92"
29
- NDTS: "50.92"
30
- NFDIS: "50.92"
31
13
  PCC: "30.60"
32
14
  PNW: "10.20"
33
15
  PPUB: "60.60"
34
- PRVC: "40.60"
35
- PRVD: "50.60"
36
- PRVDISH: "50.60"
37
- PRVDPAS: "50.60"
38
- PRVDTR: "50.60"
39
- PRVDTS: "50.60"
40
16
  PRVN: "10.60"
41
17
  PWI: "00.00"
42
- RDISH: "50.00"
43
- RFDIS: "50.00"
44
18
  RPUB: "60.00"
45
19
  SPLIT: "30.96"
46
20
  TCDV: "40.00"
47
- TDISH: "50.00"
48
- TDTR: "50.00"
49
- TDTS: "50.00"
50
21
  TPUB: "60.00"
51
22
  WPUB: "95.99"
52
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.8.0
61
+ version: 1.8.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.8.0
68
+ version: 1.8.6
69
69
  description: Library to generate, parse and manipulate IEC PubID.
70
70
  email:
71
71
  - open.source@ribose.com
@@ -79,22 +79,46 @@ files:
79
79
  - README.adoc
80
80
  - lib/pubid-iec.rb
81
81
  - lib/pubid/iec.rb
82
- - lib/pubid/iec/amendment.rb
83
- - lib/pubid/iec/corrigendum.rb
84
82
  - lib/pubid/iec/errors.rb
85
83
  - lib/pubid/iec/identifier.rb
84
+ - lib/pubid/iec/identifier/amendment.rb
86
85
  - lib/pubid/iec/identifier/base.rb
86
+ - lib/pubid/iec/identifier/component_specification.rb
87
+ - lib/pubid/iec/identifier/conformity_assessment.rb
88
+ - lib/pubid/iec/identifier/corrigendum.rb
89
+ - lib/pubid/iec/identifier/guide.rb
90
+ - lib/pubid/iec/identifier/international_standard.rb
91
+ - lib/pubid/iec/identifier/interpretation_sheet.rb
92
+ - lib/pubid/iec/identifier/operational_document.rb
93
+ - lib/pubid/iec/identifier/publicly_available_specification.rb
94
+ - lib/pubid/iec/identifier/societal_technology_trend_report.rb
95
+ - lib/pubid/iec/identifier/supplement.rb
96
+ - lib/pubid/iec/identifier/systems_reference_document.rb
97
+ - lib/pubid/iec/identifier/technical_report.rb
98
+ - lib/pubid/iec/identifier/technical_specification.rb
99
+ - lib/pubid/iec/identifier/technology_report.rb
100
+ - lib/pubid/iec/identifier/test_report_form.rb
101
+ - lib/pubid/iec/identifier/white_paper.rb
102
+ - lib/pubid/iec/identifier/working_document.rb
87
103
  - lib/pubid/iec/parser.rb
104
+ - lib/pubid/iec/renderer/amendment.rb
105
+ - lib/pubid/iec/renderer/corrigendum.rb
88
106
  - lib/pubid/iec/renderer/pubid.rb
89
107
  - lib/pubid/iec/renderer/trf_pubid.rb
90
108
  - lib/pubid/iec/renderer/trf_urn.rb
91
109
  - lib/pubid/iec/renderer/urn.rb
110
+ - lib/pubid/iec/renderer/urn_amendment.rb
111
+ - lib/pubid/iec/renderer/urn_corrigendum.rb
112
+ - lib/pubid/iec/renderer/urn_supplement.rb
113
+ - lib/pubid/iec/renderer/working_document.rb
114
+ - lib/pubid/iec/renderer/working_document_urn.rb
92
115
  - lib/pubid/iec/stage.rb
93
116
  - lib/pubid/iec/transformer.rb
94
117
  - lib/pubid/iec/trf_identifier.rb
95
118
  - lib/pubid/iec/trf_parser.rb
96
- - lib/pubid/iec/type.rb
97
119
  - lib/pubid/iec/version.rb
120
+ - lib/pubid/iec/working_document.rb
121
+ - lib/pubid/iec/working_document_parser.rb
98
122
  - stages.yaml
99
123
  - update_codes.yaml
100
124
  homepage: https://github.com/metanorma/pubid-iec
@@ -116,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
140
  - !ruby/object:Gem::Version
117
141
  version: '0'
118
142
  requirements: []
119
- rubygems_version: 3.0.3.1
143
+ rubygems_version: 3.3.26
120
144
  signing_key:
121
145
  specification_version: 4
122
146
  summary: Library to generate, parse and manipulate IEC PubID.
@@ -1,11 +0,0 @@
1
- module Pubid::Iec
2
- class Amendment < Pubid::Core::Supplement
3
- def render_pubid
4
- "AMD#{render_pubid_number}"
5
- end
6
-
7
- def render_urn
8
- ":amd#{render_urn_number}"
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module Pubid::Iec
2
- class Corrigendum < Pubid::Core::Supplement
3
- def render_pubid
4
- "COR#{render_pubid_number}"
5
- end
6
-
7
- def render_urn
8
- ":cor#{render_urn_number}"
9
- end
10
- end
11
- end
@@ -1,25 +0,0 @@
1
- module Pubid::Iec
2
- class Type < Pubid::Core::Type
3
-
4
- # # Create new type
5
- # # @param type [Symbol]
6
- # def initialize(type = :is)
7
- # type = type.to_s.downcase.to_sym unless type.is_a?(Symbol)
8
- #
9
- # raise Errors::WrongTypeError, "#{type} type is not available" unless TYPE_NAMES.key?(type)
10
- #
11
- # @type = type
12
- # end
13
-
14
- # def self.parse(type_string)
15
- # TYPE_NAMES.each do |type, values|
16
- # return new(type) if values[:short].upcase == type_string.to_s.upcase
17
- # end
18
- # raise Errors::ParseTypeError, "Cannot parse '#{type_string}' type"
19
- # end
20
-
21
- def to_s(format = :short)
22
- TYPE_NAMES[type][format]
23
- end
24
- end
25
- end