Class: Pubid::Nist::Renderer
- Inherits:
-
Renderers::Base
- Object
- Renderers::Base
- Pubid::Nist::Renderer
- Defined in:
- lib/pubid/nist/renderer.rb
Overview
Human-readable renderer for NIST identifiers.
NIST supports multiple output formats (:full, :long, :abbreviated, :short, :mr). Each series class defines public style methods (to_short_style, to_mr_style, etc.) with series-specific formatting logic, so this renderer delegates to those methods rather than reimplementing them.
Registered as the ‘:human` format in the NIST format registry and invoked via `render(format: :human, nist_format: :short)`.
Constant Summary
Constants inherited from Renderers::Base
Renderers::Base::SEMANTIC_SPLIT, Renderers::Base::TYPED_STAGE_CSS
Instance Method Summary collapse
-
#render(context: nil, nist_format: nil, **_opts) ⇒ String
Render the identifier in the requested NIST format.
Methods inherited from Renderers::Base
Constructor Details
This class inherits a constructor from Pubid::Renderers::Base
Instance Method Details
#render(context: nil, nist_format: nil, **_opts) ⇒ String
Render the identifier in the requested NIST format.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pubid/nist/renderer.rb', line 22 def render(context: nil, nist_format: nil, **_opts) id = @id effective_format = nist_format || :short effective_format = effective_format.to_sym if effective_format.is_a?(String) case effective_format when :full, :long id.public_send(:to_full_style) when :abbreviated, :abbrev id.public_send(:to_abbreviated_style) when :short id.public_send(:to_short_style) when :mr id.public_send(:to_mr_style) else id.public_send(:to_short_style) end end |