pubid-iso 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +118 -39
  3. data/lib/pubid/iso/errors.rb +0 -3
  4. data/lib/pubid/iso/harmonized_stage_code.rb +1 -145
  5. data/lib/pubid/iso/identifier/amendment.rb +52 -0
  6. data/lib/pubid/iso/identifier/base.rb +365 -0
  7. data/lib/pubid/iso/identifier/corrigendum.rb +53 -0
  8. data/lib/pubid/iso/identifier/directives.rb +29 -0
  9. data/lib/pubid/iso/identifier/guide.rb +32 -0
  10. data/lib/pubid/iso/identifier/international_standard.rb +45 -0
  11. data/lib/pubid/iso/identifier/international_standardized_profile.rb +30 -0
  12. data/lib/pubid/iso/identifier/international_workshop_agreement.rb +25 -0
  13. data/lib/pubid/iso/identifier/publicly_available_specification.rb +30 -0
  14. data/lib/pubid/iso/identifier/recommendation.rb +19 -0
  15. data/lib/pubid/iso/identifier/supplement.rb +39 -0
  16. data/lib/pubid/iso/identifier/technical_committee.rb +19 -0
  17. data/lib/pubid/iso/identifier/technical_report.rb +30 -0
  18. data/lib/pubid/iso/identifier/technical_specification.rb +30 -0
  19. data/lib/pubid/iso/identifier/technology_trends_assessments.rb +30 -0
  20. data/lib/pubid/iso/identifier.rb +39 -264
  21. data/lib/pubid/iso/parser.rb +56 -20
  22. data/lib/pubid/iso/renderer/amendment.rb +7 -0
  23. data/lib/pubid/iso/renderer/base.rb +129 -98
  24. data/lib/pubid/iso/renderer/corrigendum.rb +7 -0
  25. data/lib/pubid/iso/renderer/dir.rb +5 -3
  26. data/lib/pubid/iso/renderer/guide.rb +19 -0
  27. data/lib/pubid/iso/renderer/international_standard.rb +11 -0
  28. data/lib/pubid/iso/renderer/international_standardized_profile.rb +13 -0
  29. data/lib/pubid/iso/renderer/international_workshop_agreement.rb +17 -0
  30. data/lib/pubid/iso/renderer/publicly_available_specification.rb +12 -0
  31. data/lib/pubid/iso/renderer/recommendation.rb +13 -0
  32. data/lib/pubid/iso/renderer/supplement.rb +63 -0
  33. data/lib/pubid/iso/renderer/technical_committee.rb +47 -0
  34. data/lib/pubid/iso/renderer/technical_report.rb +13 -0
  35. data/lib/pubid/iso/renderer/technical_specification.rb +13 -0
  36. data/lib/pubid/iso/renderer/technology_trends_assessments.rb +13 -0
  37. data/lib/pubid/iso/renderer/urn-amendment.rb +12 -0
  38. data/lib/pubid/iso/renderer/urn-corrigendum.rb +12 -0
  39. data/lib/pubid/iso/renderer/urn-dir.rb +11 -3
  40. data/lib/pubid/iso/renderer/urn-supplement.rb +31 -0
  41. data/lib/pubid/iso/renderer/urn-tc.rb +2 -0
  42. data/lib/pubid/iso/renderer/urn.rb +25 -13
  43. data/lib/pubid/iso/stage.rb +1 -99
  44. data/lib/pubid/iso/transformer.rb +91 -107
  45. data/lib/pubid/iso/type.rb +9 -1
  46. data/lib/pubid/iso/version.rb +1 -1
  47. data/lib/pubid/iso.rb +20 -14
  48. data/stages.yaml +93 -0
  49. data/update_codes.yaml +1 -0
  50. metadata +37 -11
  51. data/lib/pubid/iso/amendment.rb +0 -15
  52. data/lib/pubid/iso/corrigendum.rb +0 -31
  53. data/lib/pubid/iso/renderer/french.rb +0 -29
  54. data/lib/pubid/iso/renderer/russian.rb +0 -64
  55. data/lib/pubid/iso/renderer/tc.rb +0 -30
  56. data/lib/pubid/iso/supplement.rb +0 -56
  57. data/lib/pubid/iso/typed_stage.rb +0 -204
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2023-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3.0
103
+ version: 1.5.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.3.0
110
+ version: 1.5.1
111
111
  description: Library to generate, parse and manipulate ISO PubID.
112
112
  email:
113
113
  - open.source@ribose.com
@@ -121,26 +121,52 @@ files:
121
121
  - README.adoc
122
122
  - lib/pubid-iso.rb
123
123
  - lib/pubid/iso.rb
124
- - lib/pubid/iso/amendment.rb
125
- - lib/pubid/iso/corrigendum.rb
126
124
  - lib/pubid/iso/errors.rb
127
125
  - lib/pubid/iso/harmonized_stage_code.rb
128
126
  - lib/pubid/iso/identifier.rb
127
+ - lib/pubid/iso/identifier/amendment.rb
128
+ - lib/pubid/iso/identifier/base.rb
129
+ - lib/pubid/iso/identifier/corrigendum.rb
130
+ - lib/pubid/iso/identifier/directives.rb
131
+ - lib/pubid/iso/identifier/guide.rb
132
+ - lib/pubid/iso/identifier/international_standard.rb
133
+ - lib/pubid/iso/identifier/international_standardized_profile.rb
134
+ - lib/pubid/iso/identifier/international_workshop_agreement.rb
135
+ - lib/pubid/iso/identifier/publicly_available_specification.rb
136
+ - lib/pubid/iso/identifier/recommendation.rb
137
+ - lib/pubid/iso/identifier/supplement.rb
138
+ - lib/pubid/iso/identifier/technical_committee.rb
139
+ - lib/pubid/iso/identifier/technical_report.rb
140
+ - lib/pubid/iso/identifier/technical_specification.rb
141
+ - lib/pubid/iso/identifier/technology_trends_assessments.rb
129
142
  - lib/pubid/iso/parser.rb
143
+ - lib/pubid/iso/renderer/amendment.rb
130
144
  - lib/pubid/iso/renderer/base.rb
145
+ - lib/pubid/iso/renderer/corrigendum.rb
131
146
  - lib/pubid/iso/renderer/dir.rb
132
- - lib/pubid/iso/renderer/french.rb
133
- - lib/pubid/iso/renderer/russian.rb
134
- - lib/pubid/iso/renderer/tc.rb
147
+ - lib/pubid/iso/renderer/guide.rb
148
+ - lib/pubid/iso/renderer/international_standard.rb
149
+ - lib/pubid/iso/renderer/international_standardized_profile.rb
150
+ - lib/pubid/iso/renderer/international_workshop_agreement.rb
151
+ - lib/pubid/iso/renderer/publicly_available_specification.rb
152
+ - lib/pubid/iso/renderer/recommendation.rb
153
+ - lib/pubid/iso/renderer/supplement.rb
154
+ - lib/pubid/iso/renderer/technical_committee.rb
155
+ - lib/pubid/iso/renderer/technical_report.rb
156
+ - lib/pubid/iso/renderer/technical_specification.rb
157
+ - lib/pubid/iso/renderer/technology_trends_assessments.rb
158
+ - lib/pubid/iso/renderer/urn-amendment.rb
159
+ - lib/pubid/iso/renderer/urn-corrigendum.rb
135
160
  - lib/pubid/iso/renderer/urn-dir.rb
161
+ - lib/pubid/iso/renderer/urn-supplement.rb
136
162
  - lib/pubid/iso/renderer/urn-tc.rb
137
163
  - lib/pubid/iso/renderer/urn.rb
138
164
  - lib/pubid/iso/stage.rb
139
- - lib/pubid/iso/supplement.rb
140
165
  - lib/pubid/iso/transformer.rb
141
166
  - lib/pubid/iso/type.rb
142
- - lib/pubid/iso/typed_stage.rb
143
167
  - lib/pubid/iso/version.rb
168
+ - stages.yaml
169
+ - update_codes.yaml
144
170
  homepage: https://github.com/metanorma/pubid-iso
145
171
  licenses:
146
172
  - BSD-2-Clause
@@ -1,15 +0,0 @@
1
- module Pubid::Iso
2
- class Amendment < Supplement
3
- # @param stage_format_long [Boolean] long or short format for stage rendering
4
- # @param with_date [Boolean] include date
5
- def render_pubid(stage_format_long = true, with_date = true)
6
- pubid_number = render_pubid_number(with_date: with_date)
7
-
8
- "/#{@typed_stage.to_s(stage_format_long)} #{pubid_number}"
9
- end
10
-
11
- def render_urn
12
- "#{render_urn_stage}:amd#{render_urn_number}"
13
- end
14
- end
15
- end
@@ -1,31 +0,0 @@
1
- module Pubid::Iso
2
- class Corrigendum < Supplement
3
- def render_pubid(stage_format_long = true, with_date = true)
4
- # stage = render_pubid_stage
5
- pubid_number = render_pubid_number(with_date: with_date)
6
- "/#{@typed_stage.to_s(stage_format_long)} #{pubid_number}"
7
- # case stage.to_s
8
- # when "DIS"
9
- # if stage_format_long
10
- # "/DCor #{pubid_number}"
11
- # else
12
- # "/DCOR #{pubid_number}"
13
- # end
14
- # when "FDIS"
15
- # if stage_format_long
16
- # "/FDCor #{pubid_number}"
17
- # else
18
- # "/FDCOR #{pubid_number}"
19
- # end
20
- # when ""
21
- # "/Cor #{pubid_number}"
22
- # else
23
- # "/#{stage} Cor #{pubid_number}"
24
- # end
25
- end
26
-
27
- def render_urn
28
- "#{render_urn_stage}:cor#{render_urn_number}"
29
- end
30
- end
31
- end
@@ -1,29 +0,0 @@
1
- module Pubid::Iso::Renderer
2
- class French < Base
3
- def render_typed_stage(typed_stage, opts, params)
4
- return nil if typed_stage.type == :guide
5
-
6
- super
7
- end
8
-
9
- def render_identifier(params)
10
- if @params[:typed_stage]&.type == :guide
11
- "Guide #{super(params)}"
12
- else
13
- super
14
- end
15
- end
16
-
17
- def render_copublisher(copublisher, opts, params)
18
- "/#{copublisher.to_s.sub("IEC", "CEI")}"
19
- end
20
-
21
- def render_corrigendums(corrigendums, _opts, _params)
22
- super.gsub(" ", ".")
23
- end
24
-
25
- def render_amendments(amendments, _opts, _params)
26
- super.gsub(" ", ".")
27
- end
28
- end
29
- end
@@ -1,64 +0,0 @@
1
- module Pubid::Iso::Renderer
2
- class Russian < Base
3
- PUBLISHER = { "ISO" => "ИСО", "IEC" => "МЭК" }.freeze
4
- STAGE = { "FDIS" => "ОПМС",
5
- "DIS" => "ПМС",
6
- "NP" => "НП",
7
- "AWI" => "АВИ",
8
- "CD" => "КПК",
9
- "PD" => "ПД",
10
- "FPD" => "ФПД",
11
-
12
-
13
- }.freeze
14
-
15
- TYPE = { "Guide" => "Руководство",
16
- "TS" => "ТС",
17
- "TR" => "ТО",
18
- "ISP" => "ИСП",
19
- }.freeze
20
-
21
- def render_typed_stage(typed_stage, opts, params)
22
- return nil if typed_stage.type == :guide
23
-
24
- return (params[:copublisher] ? " " : "/") + STAGE[typed_stage.to_s] if STAGE.key?(typed_stage.to_s)
25
-
26
- super
27
- end
28
-
29
- def render_identifier(params)
30
- if @params[:typed_stage]&.type == :guide
31
- "Руководство #{super(params)}"
32
- else
33
- super
34
- end
35
- end
36
-
37
- def render_publisher(publisher, _opts, _params)
38
- PUBLISHER[publisher]
39
- end
40
-
41
- def render_copublisher(copublisher, _opts, _params)
42
- # (!@copublisher.is_a?(Array) && [@copublisher]) || @copublisher
43
- if copublisher.is_a?(Array)
44
- copublisher.map(&:to_s).sort.map do |copublisher|
45
- "/#{PUBLISHER[copublisher].gsub('-', '/')}"
46
- end.join
47
- else
48
- "/#{PUBLISHER[copublisher]}"
49
- end
50
- end
51
-
52
- def render_stage(stage, _opts, params)
53
- STAGE[stage.abbr] unless stage.nil?
54
- end
55
-
56
- def render_corrigendums(corrigendums, _opts, _params)
57
- super.gsub(" ", ".")
58
- end
59
-
60
- def render_amendments(amendments, _opts, _params)
61
- super.gsub(" ", ".")
62
- end
63
- end
64
- end
@@ -1,30 +0,0 @@
1
- module Pubid::Iso::Renderer
2
- class Tc < Base
3
-
4
- def render_identifier(params)
5
- "%{publisher}%{copublisher} %{tctype} %{tcnumber}%{sctype}%{wgtype} N%{number}" % params
6
- end
7
-
8
- def render_tctype(tctype, _opts, _params)
9
- tctype.is_a?(Array) && tctype.join("/") || tctype.to_s
10
- end
11
-
12
- # TC 184/SC/WG 4 - no wg number
13
- # TC 184/SC 4/WG 12 - separate sc and wg number
14
- def render_sctype(sctype, _opts, params)
15
- if params[:wgnumber] || !params[:wgtype]
16
- "/#{sctype} #{params[:scnumber]}"
17
- else
18
- "/#{sctype}"
19
- end
20
- end
21
-
22
- def render_wgtype(wgtype, _opts, params)
23
- if params[:wgnumber]
24
- "/#{wgtype} #{params[:wgnumber]}"
25
- else
26
- "/#{wgtype} #{params[:scnumber]}"
27
- end
28
- end
29
- end
30
- end
@@ -1,56 +0,0 @@
1
- module Pubid::Iso
2
- class Supplement < Pubid::Core::Supplement
3
- attr_accessor :typed_stage, :publisher, :edition, :iteration
4
-
5
- # @param stage [Stage, Symbol, String] stage, e.g. "PWI", "NP", "50.00", Stage.new(abbr: :WD)
6
- # @param publisher [String] publisher, e.g. "ISO", "IEC" (only for DIR documents)
7
- # @param edition [Integer] edition, e.g. 1, 2, 3
8
- # @param iteration [Integer] iteration, e.g. 1, 2, 3
9
- # @see Pubid::Core::Supplement for other options
10
- def initialize(typed_stage: nil, publisher: nil, edition: nil, iteration: nil, **args)
11
- super(**args)
12
- @typed_stage = TypedStage.parse(typed_stage) if typed_stage
13
- # for DIR identifiers only
14
- @publisher = publisher.to_s
15
- @edition = edition&.to_i
16
- @iteration = iteration&.to_i
17
-
18
- if @iteration && @typed_stage.nil?
19
- raise Errors::PublishedIterationError.new("cannot assign iteration to published supplement")
20
- end
21
- end
22
-
23
- def render_pubid_stage
24
- # @typed_stage.stage.abbr != "IS" &&
25
- ((@typed_stage && @typed_stage.to_s) || "")
26
- end
27
-
28
- def render_urn_stage
29
- ((@typed_stage&.stage && ":stage-#{@typed_stage.stage.harmonized_code}") || "")
30
- end
31
-
32
- def <=>(other)
33
- (super == 0) && ((typed_stage.nil? || typed_stage == other.typed_stage) && 0 || -1) || super
34
- end
35
-
36
- def render_iteration
37
- @iteration && ".#{@iteration}"
38
- end
39
-
40
- def render_pubid_number(with_date: true)
41
- if @year && with_date
42
- "#{@number}#{render_iteration}:#{@year}"
43
- else
44
- "#{@number}#{render_iteration}"
45
- end
46
- end
47
-
48
- def render_urn_number
49
- if @year
50
- ":#{@year}:v#{@number}#{render_iteration}"
51
- else
52
- ":#{@number}#{render_iteration}:v1"
53
- end
54
- end
55
- end
56
- end
@@ -1,204 +0,0 @@
1
- module Pubid::Iso
2
- class TypedStage
3
- attr_accessor :type, :stage, :typed_stage
4
-
5
- TYPED_STAGES = {
6
- dtr: {
7
- abbr: "DTR",
8
- type: :tr,
9
- name: "Draft Technical Report",
10
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 50.00 50.20 50.60 50.92],
11
- },
12
- dis: {
13
- abbr: "DIS",
14
- type: :is,
15
- name: "Draft International Standard",
16
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93],
17
- },
18
- dts: {
19
- abbr: "DTS",
20
- type: :ts,
21
- name: "Draft Technical Specification",
22
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 50.00 50.20 50.60 50.92],
23
- },
24
- fdts: {
25
- abbr: "FDTS",
26
- type: :ts,
27
- name: "Final Draft Technical Specification",
28
- harmonized_stages: %w[50.00 50.20 50.60 50.92],
29
- },
30
- fdtr: {
31
- abbr: "FDTR",
32
- type: :tr,
33
- name: "Final Draft Technical Report",
34
- harmonized_stages: %w[50.00 50.20 50.60 50.92],
35
- },
36
- fdis: {
37
- abbr: "FDIS",
38
- type: :is,
39
- name: "Final Draft International Standard",
40
- harmonized_stages: %w[50.00 50.20 50.60 50.92],
41
- },
42
- dpas: {
43
- abbr: "DPAS",
44
- type: :pas,
45
- name: "Publicly Available Specification Draft",
46
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 50.00 50.20 50.60 50.92],
47
- },
48
- damd: {
49
- abbr: { short: "DAM", long: "DAmd" },
50
- type: :amd,
51
- name: "Draft Amendment",
52
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 50.00 50.20 50.60 50.92],
53
- },
54
- dcor: {
55
- abbr: { short: "DCOR", long: "DCor" },
56
- type: :cor,
57
- name: "Draft Corrigendum",
58
- harmonized_stages: %w[40.00 40.20 40.60 40.92 40.93 50.00 50.20 50.60 50.92],
59
- },
60
- fdamd: {
61
- abbr: { short: "FDAM", long: "FDAmd" },
62
- type: :amd,
63
- name: "Final Draft Amendment",
64
- harmonized_stages: %w[50.00 50.20 50.60 50.92],
65
- },
66
- fdcor: {
67
- abbr: { short: "FDCOR", long: "FDCor" },
68
- type: :cor,
69
- name: "Final Draft Corrigendum",
70
- harmonized_stages: %w[50.00 50.20 50.60 50.92],
71
- },
72
- }.freeze
73
-
74
- # @param type [Symbol,Type] eg. :tr, Type.new(:tr)
75
- # @param stage [Symbol,Stage] eg. :CD, Stage.new(abbr: :CD)
76
- def initialize(abbr: nil, type: nil, stage: nil)
77
- @type = type.is_a?(Type) ? type : Type.new(type) if type
78
- @stage = stage.is_a?(Stage) ? stage : Stage.new(abbr: stage) if stage
79
-
80
- if abbr
81
- raise Errors::TypeStageInvalidError, "#{abbr} is not valid typed stage" unless TYPED_STAGES.key?(abbr)
82
- assign_abbreviation(abbr)
83
- elsif !@stage.nil?
84
- # lookup for typed stage
85
- @typed_stage = lookup_typed_stage
86
- end
87
- end
88
-
89
- def lookup_typed_stage
90
- return nil unless @stage
91
-
92
- TYPED_STAGES.each do |typed_stage, values|
93
- if values[:harmonized_stages].include?(@stage.harmonized_code.to_s) && values[:type] == @type&.type
94
- return typed_stage
95
- end
96
- end
97
- nil
98
- end
99
-
100
- # Assigns type and stage according to provided typed stage abbreviation
101
- # @param abbr [Symbol] eg. :dtr, :damd, :dis
102
- def assign_abbreviation(abbr)
103
- @typed_stage = if TYPED_STAGES.key?(abbr.downcase.to_sym)
104
- abbr.downcase.to_sym
105
- else
106
- TYPED_STAGES.select do |_, v|
107
- if v[:abbr].is_a?(Hash)
108
- v[:abbr].values.include?(abbr)
109
- else
110
- v[:abbr] == abbr
111
- end
112
- end.keys.first
113
- end
114
-
115
- @type = Type.new(TYPED_STAGES[@typed_stage][:type])
116
- @stage = Stage.new(harmonized_code: HarmonizedStageCode.new(TYPED_STAGES[@typed_stage][:harmonized_stages]))
117
- end
118
-
119
- # Render typed stage
120
- # @param stage_format_long [Boolean] render stage in long or short format
121
- def to_s(stage_format_long = true)
122
- # return "" if @type == :amd || @type == :cor
123
- if @typed_stage
124
- if TYPED_STAGES[@typed_stage][:abbr].is_a?(Hash)
125
- return TYPED_STAGES[@typed_stage][:abbr][stage_format_long ? :long : :short]
126
- else
127
- return TYPED_STAGES[@typed_stage][:abbr]
128
- end
129
- end
130
-
131
- result = (@stage && @stage.abbr != "IS") ? "#{@stage.abbr}" : ""
132
- result += " " if !result.empty? && @type && stage_format_long
133
- result + if stage_format_long
134
- "#{@type&.to_s}"
135
- else
136
- if @type == :amd
137
- "AM"
138
- elsif @type == :cor
139
- "COR"
140
- else
141
- "#{@type&.to_s}"
142
- end
143
- end
144
- end
145
-
146
- # Check if typed stage listed in TYPED_STAGES constant
147
- # @param typed_stage [String,Symbol] typed stage abbreviation, eg. "DTS", :dts, "DAmd", :damd
148
- def self.has_typed_stage?(typed_stage)
149
- return true if TYPED_STAGES.key?(typed_stage)
150
-
151
- TYPED_STAGES.any? do |_, v|
152
- if v[:abbr].is_a?(Hash)
153
- v[:abbr].values.include?(typed_stage)
154
- else
155
- v[:abbr] == typed_stage
156
- end
157
- end
158
- end
159
-
160
- # Assigns stage or type or typed stage or stage and type depending on provided string
161
- # @param stage_or_typed_stage [String, Stage] eg. "DTR", "CD", Stage.new(:CD), "TR", "CD Amd", :dtr
162
- def parse_stage(stage_or_typed_stage)
163
- if self.class.has_typed_stage?(stage_or_typed_stage)
164
- return assign_abbreviation(stage_or_typed_stage)
165
- end
166
-
167
- if stage_or_typed_stage.is_a?(Stage)
168
- @stage = stage_or_typed_stage
169
- elsif stage_or_typed_stage.is_a?(String) && stage_or_typed_stage.split.count == 2 &&
170
- Stage.has_stage?(stage_or_typed_stage.split.first)
171
- # stage and type ("CD Amd")
172
- @stage = Stage.parse(stage_or_typed_stage.split.first)
173
- @type = Type.parse(stage_or_typed_stage.split.last)
174
- elsif Type.has_type?(stage_or_typed_stage)
175
- @type = Type.parse(stage_or_typed_stage)
176
- elsif Stage.has_stage?(stage_or_typed_stage)
177
- @stage = Stage.parse(stage_or_typed_stage.to_s)
178
- else
179
- raise Errors::TypeStageParseError, "cannot parse typed stage or stage"
180
- end
181
- @typed_stage = lookup_typed_stage
182
- end
183
-
184
- # Parse stage or typed stage
185
- # @return [TypedStage] typed stage object with parsed stage and typed stage
186
- def self.parse(stage_or_typed_stage)
187
- return stage_or_typed_stage if stage_or_typed_stage.is_a?(TypedStage)
188
-
189
- typed_stage = new
190
- typed_stage.parse_stage(stage_or_typed_stage)
191
- typed_stage
192
- end
193
-
194
- def name
195
- TYPED_STAGES[@typed_stage][:name]
196
- end
197
-
198
- def ==(other)
199
- return false if other.nil?
200
-
201
- type == other.type && typed_stage == other.typed_stage && stage == other.stage
202
- end
203
- end
204
- end