Class: Pubid::Iso::Renderer::Russian

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

Constant Summary collapse

PUBLISHER =
{ "ISO" => "ИСО", "IEC" => "МЭК" }.freeze
STAGE =
{ "FDIS" => "ОПМС",
          "DIS" => "ПМС",
          "NP" => "НП",
          "AWI" => "АВИ",
          "CD" => "КПК",
          "PD" => "ПД",
          "FPD" => "ФПД",


}.freeze
TYPE =
{ "Guide" => "Руководство",
         "TS" => "ТС",
         "TR" => "ТО",
         "ISP" => "ИСП",
}.freeze

Constants inherited from Base

Base::TYPE_VALUES

Instance Attribute Summary

Attributes inherited from Base

#prerendered_params

Instance Method Summary collapse

Methods inherited from Base

#prerender, #render, #render_edition, #render_iteration, #render_language, #render_short_stage, #render_supplement, #render_year

Instance Method Details

#render_amendments(amendments, _opts, _params) ⇒ Object



60
61
62
# File 'lib/pubid/iso/renderer/russian.rb', line 60

def render_amendments(amendments, _opts, _params)
  super.gsub(" ", ".")
end

#render_copublisher(copublisher, _opts, _params) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/pubid/iso/renderer/russian.rb', line 41

def render_copublisher(copublisher, _opts, _params)
  # ([email protected]_a?(Array) && [@copublisher]) || @copublisher
  if copublisher.is_a?(Array)
    copublisher.map(&:to_s).sort.map do |copublisher|
      "/#{PUBLISHER[copublisher].gsub('-', '/')}"
    end.join
  else
    "/#{PUBLISHER[copublisher]}"
  end
end

#render_corrigendums(corrigendums, _opts, _params) ⇒ Object



56
57
58
# File 'lib/pubid/iso/renderer/russian.rb', line 56

def render_corrigendums(corrigendums, _opts, _params)
  super.gsub(" ", ".")
end

#render_identifier(params) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/pubid/iso/renderer/russian.rb', line 29

def render_identifier(params)
  if @params[:typed_stage]&.type == :guide
    "Руководство #{super(params)}"
  else
    super
  end
end

#render_publisher(publisher, _opts, _params) ⇒ Object



37
38
39
# File 'lib/pubid/iso/renderer/russian.rb', line 37

def render_publisher(publisher, _opts, _params)
  PUBLISHER[publisher]
end

#render_stage(stage, _opts, params) ⇒ Object



52
53
54
# File 'lib/pubid/iso/renderer/russian.rb', line 52

def render_stage(stage, _opts, params)
  STAGE[stage.abbr] unless stage.nil?
end

#render_typed_stage(typed_stage, opts, params) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/pubid/iso/renderer/russian.rb', line 21

def render_typed_stage(typed_stage, opts, params)
  return nil if typed_stage.type == :guide

  return (params[:copublisher] ? " " : "/") + STAGE[typed_stage.to_s] if STAGE.key?(typed_stage.to_s)

  super
end