Class: Pubid::Iso::Renderer::Urn
- Inherits:
-
Core::Renderer::Urn
- Object
- Core::Renderer::Urn
- Pubid::Iso::Renderer::Urn
show all
- 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, with_date: true, with_language_code: :iso, **args) ⇒ Object
-
#render_identifier(params) ⇒ Object
-
#render_iteration(iteration, _opts, params) ⇒ Object
-
#render_part(part, opts, _params) ⇒ Object
-
#render_prefix(params) ⇒ Object
-
#render_stage(stage, _opts, params) ⇒ Object
def render_typed_stage(typed_stage, _opts, _params) “:stage-#typed_stagetyped_stage.stagetyped_stage.stage.harmonized_code” if typed_stage.stage end.
-
#render_type(type, _, _) ⇒ 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)
super
end
|
#render(with_edition: true, with_date: true, with_language_code: :iso, **args) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/pubid/iso/renderer/urn.rb', line 20
def render(with_edition: true, with_date: true, with_language_code: :iso, **args)
render_base_identifier(**args.merge(
{ with_edition: with_edition,
with_date: with_date,
with_language_code: with_language_code },
))
end
|
#render_identifier(params) ⇒ Object
32
33
34
35
|
# File 'lib/pubid/iso/renderer/urn.rb', line 32
def render_identifier(params)
render_prefix(params) + "%{stage}"\
"%{corrigendum_stage}%{iteration}%{edition}%{amendments}%{corrigendums}" % params
end
|
#render_iteration(iteration, _opts, params) ⇒ Object
45
46
47
|
# File 'lib/pubid/iso/renderer/urn.rb', line 45
def render_iteration(iteration, _opts, params)
".v#{iteration}" if params[:stage]
end
|
#render_part(part, opts, _params) ⇒ Object
57
58
59
60
61
|
# File 'lib/pubid/iso/renderer/urn.rb', line 57
def render_part(part, opts, _params)
return ":-#{part.reverse.join('-')}" if part.is_a?(Array)
":-#{part}"
end
|
#render_prefix(params) ⇒ Object
28
29
30
|
# File 'lib/pubid/iso/renderer/urn.rb', line 28
def render_prefix(params)
"urn:iso:std:%{publisher}%{copublisher}%{type}:%{number}%{part}" % params
end
|
#render_stage(stage, _opts, params) ⇒ Object
def render_typed_stage(typed_stage, _opts, _params)
":stage-#{typed_stage.stage.harmonized_code}" if typed_stage.stage
end
41
42
43
|
# File 'lib/pubid/iso/renderer/urn.rb', line 41
def render_stage(stage, _opts, params)
":stage-#{stage.harmonized_code.to_s}"
end
|
#render_type(type, _, _) ⇒ Object
49
50
51
|
# File 'lib/pubid/iso/renderer/urn.rb', line 49
def render_type(type, _, _)
":#{type.to_s.downcase}" unless type == :is
end
|
#render_year(year, _opts, _params) ⇒ Object
53
54
55
|
# File 'lib/pubid/iso/renderer/urn.rb', line 53
def render_year(year, _opts, _params)
":#{year}"
end
|