Class: Proforma::HtmlRenderer::ProformaWriter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/proforma/html_renderer/proforma_writer.rb

Overview

This class connects each Proforma object to its proper template for rendering.

Constant Summary collapse

NAMES_BY_CLASS =
{
  Modeling::Banner => 'banner.html.erb',
  Modeling::Header => 'header.html.erb',
  Modeling::Pane => 'pane.html.erb',
  Modeling::Separator => 'separator.html.erb',
  Modeling::Spacer => 'spacer.html.erb',
  Modeling::Table => 'table.html.erb',
  Modeling::Text => 'text.html.erb',
  Prototype => 'prototype.html.erb'
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object_writer: ObjectWriter.new(names_by_class: NAMES_BY_CLASS)) ⇒ ProformaWriter

Returns a new instance of ProformaWriter.



46
47
48
# File 'lib/proforma/html_renderer/proforma_writer.rb', line 46

def initialize(object_writer: ObjectWriter.new(names_by_class: NAMES_BY_CLASS))
  @object_writer = object_writer
end

Instance Attribute Details

#object_writerObject (readonly)

Returns the value of attribute object_writer.



42
43
44
# File 'lib/proforma/html_renderer/proforma_writer.rb', line 42

def object_writer
  @object_writer
end

Class Method Details

.instanceObject



26
27
28
# File 'lib/proforma/html_renderer/proforma_writer.rb', line 26

def instance
  @instance ||= new
end