Class: Pubid::Ansi::Renderer

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

Overview

Human-readable renderer for ANSI identifiers.

Produces strings like:

"ANSI X3.4"
"ANSI/ISO 9899"
"ANSI X9.8-1:2007"

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

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

  parts = []
  parts << publisher_portion(id, context)
  parts << number_portion(id, context)
  result = parts.compact.join(" ")

  result << language_portion(id) if id.languages&.any?

  result
end