class Muwu::RenderHtmlPartialBuilder::TextBuilder

Attributes

manifest_text[RW]
project[RW]
renderer[RW]

Public Class Methods

build() { |builder| ... } click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 16
def self.build
  builder = new
  yield(builder)
  builder.renderer
end
new() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 23
def initialize
  @renderer = RenderHtmlPartial::Text.new
end

Public Instance Methods

build_from_manifest_text(text) click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 28
def build_from_manifest_text(text)
  @manifest_text = text
  @project = text.project
  set_destination
  set_project
  set_text_root_name
  set_sections
  finally_set_html_attr_id
end
finally_set_html_attr_id() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 39
def finally_set_html_attr_id
  @renderer.html_attr_id = ['text', @renderer.text_root_name].join('_')
end
set_destination() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 44
def set_destination
  @renderer.destination = @manifest_text.destination
end
set_project() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 49
def set_project
  @renderer.project = @project
end
set_sections() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 59
def set_sections
  @renderer.sections = determine_sections
end
set_text_root_name() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 54
def set_text_root_name
  @renderer.text_root_name = @manifest_text.text_root_name
end

Private Instance Methods

build_text_item(text_item) click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 77
def build_text_item(text_item)
  RenderHtmlPartialBuilder::TextItemBuilder.build do |b|
    b.build_from_manifest_text_item(text_item)
  end
end
determine_sections() click to toggle source
# File lib/muwu/render_html_partial_builder/render_text_builder.rb, line 68
def determine_sections
  sections = []
  @manifest_text.sections.each do |section|
    sections << build_text_item(section)
  end
  sections
end