class Muwu::RenderHtmlPartialBuilder::ContentsBuilder

Attributes

project[RW]
renderer[RW]
task_contents[RW]
text_root_name[RW]

Public Class Methods

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

Public Instance Methods

build_from_manifest_task_contents(task_contents) click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 29
def build_from_manifest_task_contents(task_contents)
  @project = task_contents.project
  @task_contents = task_contents
  @text_root_name = task_contents.text_root_name
  phase_1_set_text_root_name
  phase_2_set_destination
  phase_2_set_href_helper
  phase_2_set_html_attr_id
  phase_2_set_item_depth_max
  phase_2_set_project
  phase_2_set_sections
  phase_2_set_will_render_section_numbers
end
phase_1_set_text_root_name() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 44
def phase_1_set_text_root_name
  @renderer.text_root_name = @text_root_name
end
phase_2_set_destination() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 49
def phase_2_set_destination
  @renderer.destination = @task_contents.destination
end
phase_2_set_href_helper() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 54
def phase_2_set_href_helper
  @renderer.href_helper = Helper::HtmlHrefHelper.new(@task_contents)
end
phase_2_set_html_attr_id() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 59
def phase_2_set_html_attr_id
  @renderer.html_attr_id = ['contents', @text_root_name].join('_')
end
phase_2_set_item_depth_max() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 64
def phase_2_set_item_depth_max
  @renderer.item_depth_max = @project.options.render_sections_distinctly_depth_max
end
phase_2_set_project() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 69
def phase_2_set_project
  @renderer.project = @project
end
phase_2_set_sections() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 74
def phase_2_set_sections
  @renderer.sections = determine_sections
end
phase_2_set_will_render_section_numbers() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 79
def phase_2_set_will_render_section_numbers
  @renderer.will_render_section_numbers = @project.options.render_section_numbers
end

Private Instance Methods

determine_sections() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 88
def determine_sections
  determine_text_root_blocks.map { |trb| trb.sections }.flatten
end
determine_text_root_blocks() click to toggle source
# File lib/muwu/render_html_partial_builder/render_contents_builder.rb, line 93
def determine_text_root_blocks
  @task_contents.text_blocks_by_name(@text_root_name)
end