Class: Pubid::Csa::Renderer

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

Overview

Human-readable renderer for CSA identifiers that extend Pubid::Identifier.

Produces strings like:

"CSA B149.1:20"
"CAN/CSA-C22.2 NO. 60601-1-9:15"
"CSA C22.2 NO. 286:23"
"CSA MH SERIES 3.14:20"

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

Note: Some CSA identifier types (Bundled, Combined, CanadianAdopted, CsaAdopted, Package) extend Lutaml::Model::Serializable directly, not Pubid::Identifier, so they keep their own to_s implementations.

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



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pubid/csa/renderer.rb', line 20

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

  case id
  when Identifiers::Series
    render_series(id)
  when Identifiers::Cec
    render_cec(id)
  else
    render_base(id)
  end
end