Class: Pubid::Iso::Renderer::Urn
- Inherits:
-
Core::Renderer::Urn
- Object
- Core::Renderer::Urn
- Pubid::Iso::Renderer::Urn
- Defined in:
- lib/pubid/iso/renderer/urn.rb
Constant Summary collapse
- STAGES =
{ PWI: 0, NP: 10, AWI: 20, WD: 20.20, CD: 30, DIS: 40, FDIS: 50, PRF: 50, IS: 60 }.freeze
Instance Method Summary collapse
- #prerender(with_edition: true, **args) ⇒ Object
-
#render(with_edition: true, **args) ⇒ Object
Render identifier.
- #render_identifier(params) ⇒ Object
-
#render_iteration(iteration, _opts, params) ⇒ Object
def render_stage(stage, _opts, params) “:stage-#stagestage.harmonized_code” end.
- #render_type(type, _, _) ⇒ Object
- #render_typed_stage(typed_stage, _opts, _params) ⇒ Object
- #render_year(year, _opts, _params) ⇒ Object
Instance Method Details
#prerender(with_edition: true, **args) ⇒ Object
13 14 15 16 |
# File 'lib/pubid/iso/renderer/urn.rb', line 13 def prerender(with_edition: true, **args) @params[:type_stage] = @params.slice(:stage, :type) if @params[:stage] || @params[:type] super end |
#render(with_edition: true, **args) ⇒ Object
Render identifier
21 22 23 24 25 |
# File 'lib/pubid/iso/renderer/urn.rb', line 21 def render(with_edition: true, **args) # copy type from typed stage @params[:type] = @params[:typed_stage].type if @params[:typed_stage] && @params[:typed_stage].type super(**args.merge({ with_edition: with_edition })) end |
#render_identifier(params) ⇒ Object
27 28 29 30 |
# File 'lib/pubid/iso/renderer/urn.rb', line 27 def render_identifier(params) render_base(params) + "%{typed_stage}"\ "%{corrigendum_stage}%{iteration}%{edition}%{amendments}%{corrigendums}" % params end |
#render_iteration(iteration, _opts, params) ⇒ Object
def render_stage(stage, _opts, params)
":stage-#{stage.harmonized_code}"
end
39 40 41 |
# File 'lib/pubid/iso/renderer/urn.rb', line 39 def render_iteration(iteration, _opts, params) ".v#{iteration}" if params[:typed_stage]&.stage end |
#render_type(type, _, _) ⇒ Object
43 44 45 |
# File 'lib/pubid/iso/renderer/urn.rb', line 43 def render_type(type, _, _) ":#{type.to_s.downcase}" unless type == :is end |
#render_typed_stage(typed_stage, _opts, _params) ⇒ Object
32 33 34 |
# File 'lib/pubid/iso/renderer/urn.rb', line 32 def render_typed_stage(typed_stage, _opts, _params) ":stage-#{typed_stage.stage.harmonized_code}" if typed_stage.stage end |
#render_year(year, _opts, _params) ⇒ Object
47 48 49 |
# File 'lib/pubid/iso/renderer/urn.rb', line 47 def render_year(year, _opts, _params) ":#{year}" end |