Class: Pubid::Iec::Renderer
- Inherits:
-
Renderers::Base
- Object
- Renderers::Base
- Pubid::Iec::Renderer
- Defined in:
- lib/pubid/iec/renderer.rb
Overview
Human-readable renderer for IEC identifiers.
Components are accessed only through ‘component.render(context:)`.
Produces strings like:
"IEC 60038:2009"
"IEC/CD 60038"
"IEC 60038:2009/AMD1:2011"
"IEC/FDAM 60038-1"
"IEC 60529:1989+AMD1:1999 CSV"
The renderer is registered as the ‘:human` format in the IEC format registry and invoked via `render(format: :human)`.
For simple (non-wrapper) identifiers, the renderer delegates to the identifier’s own ‘publisher_portion` / `number_portion` helpers so that per-type overrides (e.g. TR, TS, Guide) continue to work without duplication. Wrapper types (Consolidated, VAP, Sheet, Fragment, Supplement, WorkingDocument, TestReportForm) have rendering logic here because their structure differs fundamentally.
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
Constructor Details
This class inherits a constructor from Pubid::Renderers::Base
Instance Method Details
#render(context: nil, **opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pubid/iec/renderer.rb', line 26 def render(context: nil, **opts) id = @id case id when Identifiers::ConsolidatedIdentifier render_consolidated(id, opts, context) when Identifiers::VapIdentifier render_vap(id, opts, context) when Identifiers::SheetIdentifier render_sheet(id, opts, context) when Identifiers::FragmentIdentifier render_fragment(id, opts, context) when Identifiers::WorkingDocument render_working_document(id, context) when Identifiers::TestReportForm render_test_report_form(id, context) when SupplementIdentifier render_supplement(id, opts, context) else render_single(id, opts, context) end end |