Class: Pubid::Iso::Renderer::UrnSupplement
- Inherits:
-
Urn
- Object
- Core::Renderer::Urn
- Urn
- Pubid::Iso::Renderer::UrnSupplement
show all
- Defined in:
- lib/pubid/iso/renderer/urn-supplement.rb
Constant Summary
collapse
- TYPE =
"sup".freeze
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
12
13
14
15
16
17
|
# File 'lib/pubid/iso/renderer/urn-supplement.rb', line 12
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
7
8
9
10
|
# File 'lib/pubid/iso/renderer/urn-supplement.rb', line 7
def render_identifier(params)
"%{base}%{stage}:#{self.class::TYPE}%{publisher}%{year}%{number}%{edition}" \
"#{@params[:base].language ? (':' + @params[:base].language) : ''}" % params
end
|
#render_number(number, _opts, params) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/pubid/iso/renderer/urn-supplement.rb', line 19
def render_number(number, _opts, params)
if params[:year]
":v#{number}"
else
":#{number}:v1"
end
end
|
#render_publisher(publisher, _opts, _params) ⇒ Object
27
28
29
|
# File 'lib/pubid/iso/renderer/urn-supplement.rb', line 27
def render_publisher(publisher, _opts, _params)
":#{publisher.downcase}" unless publisher.empty?
end
|