Class: Pubid::Iec::Renderer::Urn
- Inherits:
-
Core::Renderer::Urn
- Object
- Core::Renderer::Urn
- Pubid::Iec::Renderer::Urn
- Defined in:
- lib/pubid/iec/renderer/urn.rb
Direct Known Subclasses
Constant Summary collapse
- STAGES =
{ ACD: 20.99, ACDV: 30.99, ADTR: 40.99, ADTS: 40.99, AFDIS: 40.99, APUB: 50.99, BPUB: 60, CAN: 30.98, CCDV: 40.20, CD: 30.20, CDISH: 50.20, CDM: 30.60, CDPAS: 50.20, CDTR: 50.20, CDTS: 50.20, CDVM: 40.91, CFDIS: 50.20, DECDISH: 50.00, DECFDIS: 50.00, DECPUB: 60.00, DEL: 10.98, DELPUB: 99.60, DTRM: 50.92, DTSM: 50.92, MERGED: 30.97, NCDV: 40.91, NDTR: 50.92, NDTS: 50.92, NFDIS: 50.92, PCC: 30.60, PNW: 10.20, PPUB: 60.60, PRVC: 40.60, PRVD: 50.60, PRVDISH: 50.60, PRVDPAS: 50.60, PRVDTR: 50.60, PRVDTS: 50.60, PRVN: 10.60, PWI: 0, RDISH: 50.00, RFDIS: 50.00, RPUB: 60.00, SPLIT: 30.96, TCDV: 40.00, TDISH: 50.00, TDTR: 50.00, TDTS: 50.00, TPUB: 60.00, WPUB: 95.99 }.freeze
Instance Method Summary collapse
- #render_amendments(amendments, _opts, _params) ⇒ Object
- #render_conjuction_part(conjuction_parts, _opts, _params) ⇒ Object
- #render_corrigendums(corrigendums, _opts, _params) ⇒ Object
- #render_fragment(fragment, _opts, _params) ⇒ Object
- #render_identifier(params) ⇒ Object
- #render_language(language, _opts, _params) ⇒ Object
- #render_number(number, _opts, _params) ⇒ Object
- #render_part_version(part_version, _opts, _params) ⇒ Object
- #render_stage(stage, _opts, params) ⇒ Object
- #render_type(type, _, _) ⇒ Object
- #render_vap(vap, _opts, _params) ⇒ Object
- #render_version(version, _opts, _params) ⇒ Object
Instance Method Details
#render_amendments(amendments, _opts, _params) ⇒ Object
98 99 100 |
# File 'lib/pubid/iec/renderer/urn.rb', line 98 def render_amendments(amendments, _opts, _params) amendments&.map(&:urn)&.join || "" end |
#render_conjuction_part(conjuction_parts, _opts, _params) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/pubid/iec/renderer/urn.rb', line 82 def render_conjuction_part(conjuction_parts, _opts, _params) if conjuction_parts.is_a?(Array) conjuction_parts.map(&:to_i).sort.map { |conjuction_part| ",#{conjuction_part}" }.join else ",#{conjuction_parts}" end end |
#render_corrigendums(corrigendums, _opts, _params) ⇒ Object
102 103 104 |
# File 'lib/pubid/iec/renderer/urn.rb', line 102 def render_corrigendums(corrigendums, _opts, _params) corrigendums&.map(&:urn)&.join || "" end |
#render_fragment(fragment, _opts, _params) ⇒ Object
70 71 72 |
# File 'lib/pubid/iec/renderer/urn.rb', line 70 def render_fragment(fragment, _opts, _params) ":frag:#{fragment}" end |
#render_identifier(params) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/pubid/iec/renderer/urn.rb', line 55 def render_identifier(params) "urn:iec:std:%{publisher}%{copublisher}%{type}:%{number}"\ "%{part}%{conjuction_part}%{year}%{stage}%{vap}"\ "%{urn_stage}%{corrigendum_stage}%{iteration}%{version}%{part_version}"\ "%{edition}%{amendments}%{corrigendums}%{fragment}" % params end |
#render_language(language, _opts, _params) ⇒ Object
106 107 108 |
# File 'lib/pubid/iec/renderer/urn.rb', line 106 def render_language(language, _opts, _params) ":" + (language.is_a?(Array) ? language.join("-") : language) end |
#render_number(number, _opts, _params) ⇒ Object
62 63 64 |
# File 'lib/pubid/iec/renderer/urn.rb', line 62 def render_number(number, _opts, _params) number.to_s.downcase end |
#render_part_version(part_version, _opts, _params) ⇒ Object
78 79 80 |
# File 'lib/pubid/iec/renderer/urn.rb', line 78 def render_part_version(part_version, _opts, _params) ":v#{part_version}" end |
#render_stage(stage, _opts, params) ⇒ Object
90 91 92 |
# File 'lib/pubid/iec/renderer/urn.rb', line 90 def render_stage(stage, _opts, params) ":stage-#{sprintf('%s', stage.to_s(:urn))}" end |
#render_type(type, _, _) ⇒ Object
94 95 96 |
# File 'lib/pubid/iec/renderer/urn.rb', line 94 def render_type(type, _, _) ":#{type.downcase}" end |
#render_vap(vap, _opts, _params) ⇒ Object
66 67 68 |
# File 'lib/pubid/iec/renderer/urn.rb', line 66 def render_vap(vap, _opts, _params) ":#{vap.downcase}" end |
#render_version(version, _opts, _params) ⇒ Object
74 75 76 |
# File 'lib/pubid/iec/renderer/urn.rb', line 74 def render_version(version, _opts, _params) ":v#{version}" end |