Class: Pubid::Iso::Renderer::Dir

Inherits:
Base
  • Object
show all
Defined in:
lib/pubid/iso/renderer/dir.rb

Constant Summary

Constants inherited from Base

Base::TRANSLATION, Base::TYPE

Instance Attribute Summary

Attributes inherited from Base

#prerendered_params

Instance Method Summary collapse

Methods inherited from Base

#omit_post_publisher_symbol?, #postrender_stage, #render, #render_addendum, #render_base, #render_base_identifier, #render_copublisher_string, #render_iteration, #render_language, #render_part, #render_publisher, #render_stage, #render_type_prefix, #render_typed_stage, #render_year

Instance Method Details

#render_dirtype(dirtype, _opts, _params) ⇒ Object



26
27
28
# File 'lib/pubid/iso/renderer/dir.rb', line 26

def render_dirtype(dirtype, _opts, _params)
  " #{dirtype}"
end

#render_edition(edition, _opts, _params) ⇒ Object



30
31
32
# File 'lib/pubid/iso/renderer/dir.rb', line 30

def render_edition(edition, _opts, _params)
  " #{edition[:publisher]}" + (edition[:year] ? ":#{edition[:year]}" : "")
end

#render_identifier(params, opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pubid/iso/renderer/dir.rb', line 6

def render_identifier(params, opts)
  if params.key?(:jtc_dir)
    res = ("%{publisher}%{dirtype}%{number} DIR%{year}%{edition}" % params)
  else
    res = ("%{publisher} DIR%{dirtype}%{number}%{year}%{edition}" % params)
  end

  if params.key?(:joint_document)
    joint_params = prerender_params(params[:joint_document].to_h(deep: false), {})
    joint_params.default = ""
    res += (" + %{publisher}%{dirtype}%{number}%{year}" % joint_params)
  end

  res
end

#render_number(number, _opts, _params) ⇒ Object



22
23
24
# File 'lib/pubid/iso/renderer/dir.rb', line 22

def render_number(number, _opts, _params)
  " #{number}"
end