Class: Pubid::Iso::Renderer::Supplement
- Inherits:
-
Base
- Object
- Core::Renderer::Base
- Base
- Pubid::Iso::Renderer::Supplement
show all
- Defined in:
- lib/pubid/iso/renderer/supplement.rb
Constant Summary
collapse
- TYPE =
"Suppl".freeze
Constants inherited
from Base
Base::TRANSLATION
Instance Attribute Summary
Attributes inherited from Base
#prerendered_params
Instance Method Summary
collapse
-
#render(with_edition: true, with_language_code: :iso, with_date: true, **args) ⇒ Object
-
#render_edition(edition, opts, _params) ⇒ Object
-
#render_identifier(params, opts) ⇒ Object
-
#render_month(month, _opts, _params) ⇒ Object
-
#render_number(number, opts, _params) ⇒ Object
-
#render_publisher(publisher, opts, params) ⇒ Object
-
#render_stage(stage, opts, params) ⇒ Object
Methods inherited from Base
#omit_post_publisher_symbol?, #postrender_stage, #render_addendum, #render_base, #render_base_identifier, #render_copublisher_string, #render_iteration, #render_language, #render_part, #render_type_prefix, #render_typed_stage, #render_year
Instance Method Details
#render(with_edition: true, with_language_code: :iso, with_date: true, **args) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 10
def render(with_edition: true, with_language_code: :iso, with_date: true, **args)
@params[:base].to_s(lang: args[:language], with_edition: with_edition) +
super(
with_edition: with_edition, with_language_code: with_language_code, with_date: with_date,
base_type: @params[:base].type[:key],
**args
) +
if @params[:base].language
render_language(@params[:base].language,
{ with_language_code: with_language_code }, nil).to_s
else
""
end
end
|
#render_edition(edition, opts, _params) ⇒ Object
61
62
63
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 61
def render_edition(edition, opts, _params)
" Edition #{edition}" if opts[:with_edition]
end
|
#render_identifier(params, opts) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 25
def render_identifier(params, opts)
type_prefix = params[:stage].nil? || !params[:stage].is_a?(Pubid::Core::TypedStage) ? self.class::TYPE : ""
stage = params[:stage]
if params[:stage].instance_of?(Pubid::Core::Stage) && !params[:stage].to_s(with_prf: opts[:with_prf]).empty?
type_prefix = " #{type_prefix}"
stage = params[:stage].to_s(with_prf: opts[:with_prf])
end
if self.class == Supplement
if opts[:base_type] == :dir
"%{stage}%{publisher} SUP%{number}%{part}%{iteration}%{year}%{month}%{edition}" % params
else
"/#{stage}#{type_prefix}%{number}%{part}%{iteration}%{year}%{edition}" % params
end
else
"/#{stage}#{type_prefix}%{number}%{part}%{iteration}%{year}%{edition}" % params
end
end
|
#render_month(month, _opts, _params) ⇒ Object
65
66
67
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 65
def render_month(month, _opts, _params)
"-#{month}"
end
|
#render_number(number, opts, _params) ⇒ Object
46
47
48
49
50
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 46
def render_number(number, opts, _params)
space = opts[:language] == :french ? "." : " "
"#{space}#{number}"
end
|
#render_publisher(publisher, opts, params) ⇒ Object
57
58
59
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 57
def render_publisher(publisher, opts, params)
" #{publisher}" unless publisher.empty?
end
|
#render_stage(stage, opts, params) ⇒ Object
52
53
54
55
|
# File 'lib/pubid/iso/renderer/supplement.rb', line 52
def render_stage(stage, opts, params)
stage unless params[:typed_stage]
end
|