Class: Pubid::Jcgm::Renderer

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

Overview

Human-readable renderer for JCGM identifiers.

Produces strings like:

"JCGM 100:2008"
"JCGM 100:2008/Amd 1:2023"
"JCGM GUM-6:2020"

The renderer is registered as the ‘:human` format in the JCGM format registry and invoked via `render(format: :human)`.

Constant Summary

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



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pubid/jcgm/renderer.rb', line 15

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

  case id
  when Identifiers::Amendment
    render_amendment(id, context)
  when Identifiers::GumGuide
    render_gum_guide(id, context)
  else
    render_single(id)
  end
end