Class: Muwu::Helper::HtmlHrefHelper

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/helper/html_href_helper.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Method Summary collapse

Methods included from Muwu

debug, read

Constructor Details

#initialize(origin_task) ⇒ HtmlHrefHelper

Returns a new instance of HtmlHrefHelper.



14
15
16
17
# File 'lib/muwu/helper/html_href_helper.rb', line 14

def initialize(origin_task)
  @origin_task = origin_task
  @project = origin_task.project
end

Instance Method Details

#to_contents_heading(text_object) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/muwu/helper/html_href_helper.rb', line 36

def to_contents_heading(text_object)
  result = ''
  case @origin_task
  when ManifestTask::TextItem
    filename = target_contents_filename(text_object)
    anchor_id = attr_id(:contents, text_object)
    result = filename + anchor_id
  end
  result
end

#to_document_topObject



48
49
50
# File 'lib/muwu/helper/html_href_helper.rb', line 48

def to_document_top
  '#top'
end

#to_project_homeObject



53
54
55
# File 'lib/muwu/helper/html_href_helper.rb', line 53

def to_project_home
  @project.manifest.find_document_html_by_index(0).destination.output_filename
end

#to_text_item(text_object) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/muwu/helper/html_href_helper.rb', line 24

def to_text_item(text_object)
  result = ''
  case @origin_task
  when ManifestTask::Contents
    result = target_text_filename(text_object) + attr_id(:text, text_object)
  when ManifestTask::Subcontents
    result = attr_id(:text, text_object)
  end
  result
end