Class: Pubid::Iso::Renderer::UrnExtract
- Inherits:
-
Urn
- Object
- Core::Renderer::Urn
- Urn
- Pubid::Iso::Renderer::UrnExtract
show all
- Defined in:
- lib/pubid/iso/renderer/urn-extract.rb
Constant Summary
Constants inherited
from Urn
Pubid::Iso::Renderer::Urn::STAGES
Instance Method Summary
collapse
Methods inherited from Urn
#prerender, #render, #render_iteration, #render_part, #render_prefix, #render_stage, #render_type, #render_year
Instance Method Details
#render_base(base, _opts, _params) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/pubid/iso/renderer/urn-extract.rb', line 10
def render_base(base, _opts, _params)
return base.urn if base.base || base.is_a?(Pubid::Iso::Identifier::Directives)
Urn.new(base.to_h(deep: false)).render
end
|
#render_identifier(params) ⇒ Object
5
6
7
8
|
# File 'lib/pubid/iso/renderer/urn-extract.rb', line 5
def render_identifier(params)
"%{base}%{stage}:ext%{year}%{number}%{edition}" \
"#{@params[:base].language ? (':' + @params[:base].language) : ''}" % params
end
|
#render_number(number, _opts, params) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/pubid/iso/renderer/urn-extract.rb', line 17
def render_number(number, _opts, params)
if params[:year]
":v#{number}"
else
":#{number}:v1"
end
end
|