Class: Pubid::Api::Renderer

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

Overview

Human-readable renderer for API identifiers.

Produces strings like:

"API Std 650"
"API MPMS CH 4.1"
"API 5L-2018"

The renderer is registered as the :human format in the API 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/api/renderer.rb', line 15

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

  case id
  when Identifiers::Mpms
    render_mpms(id)
  when Identifiers::TypelessStandard
    render_typeless(id)
  else
    render_default(id)
  end
end