Class: Pubid::Ogc::Renderer

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

Overview

Human-readable renderer for OGC identifiers.

Produces the canonical printed form, e.g.:

"24-032r1"
"01-009a"
"OGC 24-032r1"   (only when with_publisher: true)

Registered as the :human format in the OGC format registry and invoked via render(format: :human).

Constant Summary collapse

PUBLISHER =
"OGC"

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(**_opts) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/pubid/ogc/renderer.rb', line 17

def render(**_opts)
  id = @id
  result = +""
  result << "#{PUBLISHER} " if with_publisher?(id)
  result << "#{id.year}-#{id.number}"
  result << id.revision.to_s if id.revision
  result
end