Class: Pubid::Astm::Renderer

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

Overview

Human-readable renderer for ASTM identifiers.

Consolidates the per-type rendering logic that used to live inline on each identifier class. Produces strings like:

"ASTM E2938-15"
"ASTM RR:A01-1234"
"ASTM MNL45-EB"
"ASTM ADJD2148"

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pubid/astm/renderer.rb', line 14

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

  case id
  when Identifiers::Standard
    render_standard(id)
  when Identifiers::IsoDualPublished
    render_standard(id)
  when Identifiers::ResearchReport
    render_research_report(id)
  when Identifiers::DataSeries
    render_data_series(id)
  when Identifiers::TechnicalReport
    render_technical_report(id)
  when Identifiers::Monograph
    render_monograph(id)
  when Identifiers::Adjunct
    render_adjunct(id)
  when Identifiers::WorkInProgress
    render_work_in_progress(id)
  when Identifiers::Manual
    render_manual(id)
  else
    render_single(id)
  end
end