Class: Muwu::RenderHtmlPartialBuilder::ContentsBuilder

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/render_html_partial_builder/render_contents_builder.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Muwu

debug, read

Constructor Details

#initializeContentsBuilder

Returns a new instance of ContentsBuilder.



24
25
26
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 24

def initialize
  @renderer = RenderHtmlPartial::Contents.new
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



9
10
11
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 9

def project
  @project
end

#rendererObject

Returns the value of attribute renderer.



9
10
11
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 9

def renderer
  @renderer
end

#task_contentsObject

Returns the value of attribute task_contents.



9
10
11
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 9

def task_contents
  @task_contents
end

#text_root_nameObject

Returns the value of attribute text_root_name.



9
10
11
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 9

def text_root_name
  @text_root_name
end

Class Method Details

.build {|builder| ... } ⇒ Object

Yields:

  • (builder)


17
18
19
20
21
# File 'lib/muwu/render_html_partial_builder/render_contents_builder.rb', line 17

def self.build
  builder = new
  yield(builder)
  builder.renderer
end

Instance Method Details

#build_from_manifest_task_contents(task_contents) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# 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_nameObject



44
45
46
# 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_destinationObject



49
50
51
# 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_helperObject



54
55
56
# 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_idObject



59
60
61
# 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_maxObject



64
65
66
# 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_projectObject



69
70
71
# 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_sectionsObject



74
75
76
# 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_numbersObject



79
80
81
# 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