Class: Pubid::Iec::Renderer::TrfPubid

Inherits:
Pubid
  • Object
show all
Defined in:
lib/pubid/iec/renderer/trf_pubid.rb

Instance Method Summary collapse

Methods inherited from Pubid

#render_amendments, #render_corrigendums, #render_database, #render_day, #render_edition, #render_fragment, #render_language, #render_month, #render_sheet, #render_stage, #render_type, #render_typed_stage, #render_version, #supplement_prefix

Instance Method Details

#render_conjuction_part(conjuction_parts, _opts, _params) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 13

def render_conjuction_part(conjuction_parts, _opts, _params)
  conjunction_symbol = case _params[:publisher]
                       when "IECEE"
                         # IECEE TRFs use '&' as parts separator (IECEE OD-2020)
                         "&"
                       else
                         # when "IECEx"
                         # IECEx TRFs use ',' as parts separator (IECEx OD-010-1)
                         ","
                       end

  if conjuction_parts.is_a?(Array)
    conjuction_parts.map(&:to_i).sort.map { |conjuction_part| "#{conjunction_symbol}#{conjuction_part}" }.join
  else
    "#{conjunction_symbol}#{conjuction_parts}"
  end
end

#render_identifier(params) ⇒ Object



3
4
5
6
7
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 3

def render_identifier(params)
  "%{publisher}%{copublisher} TRF%{trf_publisher} %{number}%{part}%{conjuction_part}"\
  "%{part_version}%{version}%{trf_version}%{decision_sheet}%{trf_series}%{test_type}"\
  "%{year}%{vap}" % params
end

#render_test_type(test_type, _opts, _params) ⇒ Object



35
36
37
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 35

def render_test_type(test_type, _opts, _params)
  "_#{test_type}"
end

#render_trf_publisher(trf_publisher, _opts, _params) ⇒ Object



31
32
33
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 31

def render_trf_publisher(trf_publisher, _opts, _params)
  " #{trf_publisher}"
end

#render_trf_series(trf_series, _opts, _params) ⇒ Object



39
40
41
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 39

def render_trf_series(trf_series, _opts, _params)
  "_SE"
end

#render_vap(vap, _opts, _params) ⇒ Object



9
10
11
# File 'lib/pubid/iec/renderer/trf_pubid.rb', line 9

def render_vap(vap, _opts, _params)
  " #{vap}"
end