Class: Pubid::Easc::Renderer

Inherits:
Renderers::Base show all
Defined in:
lib/pubid/easc/renderer.rb

Overview

Human-readable renderer for EASC identifiers.

Produces strings like:

"ПМГ 03-2025"
"ПМГ В 31-2001"      (defense variant)
"РМГ 151-2025"

Always renders in Cyrillic — the canonical form used on mgscatalog.by. Latin transliterations (PMG, RMG, V) parse but render to Cyrillic.

Constant Summary collapse

CYRILLIC_SERIES =
{
  "PMG" => "ПМГ",
  "RMG" => "РМГ",
}.freeze
CYRILLIC_VARIANT =
"В".freeze

Constants inherited from Renderers::Base

Renderers::Base::SEMANTIC_SPLIT, Renderers::Base::TYPED_STAGE_CSS

Instance Method Summary collapse

Methods inherited from Renderers::Base

#initialize, render

Constructor Details

This class inherits a constructor from Pubid::Renderers::Base

Instance Method Details

#render(context: nil, **_opts) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
# File 'lib/pubid/easc/renderer.rb', line 23

def render(context: nil, **_opts)
  id = @id

  if id.is_a?(Identifiers::Pmg) || id.is_a?(Identifiers::Rmg)
    return render_standard(id)
  end

  raise ArgumentError, "Unknown EASC identifier class: #{id.class}"
end