Class: Muwu::ManifestTask::TextItem

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/manifest_task/text_item.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Muwu

debug, read

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def destination
  @destination
end

#headingObject

Returns the value of attribute heading.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def heading
  @heading
end

#heading_originObject

Returns the value of attribute heading_origin.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def heading_origin
  @heading_origin
end

#namingObject

Returns the value of attribute naming.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def naming
  @naming
end

#numberingObject

Returns the value of attribute numbering.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def numbering
  @numbering
end

#outlineObject

Returns the value of attribute outline.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def outline
  @outline
end

#projectObject

Returns the value of attribute project.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def project
  @project
end

#sectionsObject

Returns the value of attribute sections.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def sections
  @sections
end

#source_filenameObject

Returns the value of attribute source_filename.



9
10
11
# File 'lib/muwu/manifest_task/text_item.rb', line 9

def source_filename
  @source_filename
end

Instance Method Details

#does_have_child_sectionsObject



36
37
38
# File 'lib/muwu/manifest_task/text_item.rb', line 36

def does_have_child_sections
  is_parent_heading && (@sections.length >= 1)
end

#inspectObject



22
23
24
# File 'lib/muwu/manifest_task/text_item.rb', line 22

def inspect
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
end

#inspect_instance_variablesObject



27
28
29
# File 'lib/muwu/manifest_task/text_item.rb', line 27

def inspect_instance_variables
  self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
end

#is_not_parent_headingObject



41
42
43
# File 'lib/muwu/manifest_task/text_item.rb', line 41

def is_not_parent_heading
  is_parent_heading == false
end

#is_parent_headingObject



46
47
48
# File 'lib/muwu/manifest_task/text_item.rb', line 46

def is_parent_heading
  Array === @sections
end

#naming_downcaseObject



51
52
53
# File 'lib/muwu/manifest_task/text_item.rb', line 51

def naming_downcase
  @naming.map {|n| n.downcase}
end

#naming_downcase_without_text_rootObject



56
57
58
# File 'lib/muwu/manifest_task/text_item.rb', line 56

def naming_downcase_without_text_root
  naming_without_text_root.map {|n| n.downcase}
end

#naming_without_text_rootObject



61
62
63
# File 'lib/muwu/manifest_task/text_item.rb', line 61

def naming_without_text_root
  @naming[1..-1]
end

#numbering_to_depth_maxObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/muwu/manifest_task/text_item.rb', line 66

def numbering_to_depth_max
  # using a truthy conditional because the option could be an integer, nil, or a boolean false
  if @project.options.render_sections_distinctly_depth_max
    index_min = 0
    index_max = @project.options.render_sections_distinctly_depth_max - 1
    if index_max >= index_min
      @numbering[index_min..index_max]
    else # fallback to @numbering so code doesn't break
      @numbering
    end
  else
    @numbering
  end
end

#project_directoryObject



82
83
84
# File 'lib/muwu/manifest_task/text_item.rb', line 82

def project_directory
  @project.working_directory
end

#section_depthObject



87
88
89
# File 'lib/muwu/manifest_task/text_item.rb', line 87

def section_depth
  @numbering.length
end

#sourceObject



92
93
94
# File 'lib/muwu/manifest_task/text_item.rb', line 92

def source
  File.read(source_filename_absolute)
end

#source_file_does_existObject



97
98
99
# File 'lib/muwu/manifest_task/text_item.rb', line 97

def source_file_does_exist
  File.exist?(source_filename_absolute) == true
end

#source_file_does_not_existObject



102
103
104
# File 'lib/muwu/manifest_task/text_item.rb', line 102

def source_file_does_not_exist
  File.exist?(source_filename_absolute) == false
end

#source_filename_absoluteObject



107
108
109
# File 'lib/muwu/manifest_task/text_item.rb', line 107

def source_filename_absolute
  File.absolute_path(File.join(project_directory, source_filename))
end

#source_filename_relativeObject



112
113
114
# File 'lib/muwu/manifest_task/text_item.rb', line 112

def source_filename_relative
  source_filename
end

#text_root_nameObject



117
118
119
# File 'lib/muwu/manifest_task/text_item.rb', line 117

def text_root_name
  @naming[0]
end