class Muwu::ManifestTask::TextItem

Attributes

destination[RW]
heading[RW]
heading_origin[RW]
naming[RW]
numbering[RW]
outline[RW]
project[RW]
sections[RW]
source_filename[RW]

Public Instance Methods

does_have_child_sections() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 36
def does_have_child_sections
  is_parent_heading && (@sections.length >= 1)
end
inspect() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 22
def inspect
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
end
inspect_instance_variables() click to toggle source
# 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_heading() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 41
def is_not_parent_heading
  is_parent_heading == false
end
is_parent_heading() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 46
def is_parent_heading
  Array === @sections
end
naming_downcase() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 51
def naming_downcase
  @naming.map {|n| n.downcase}
end
naming_downcase_without_text_root() click to toggle source
# 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_root() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 61
def naming_without_text_root
  @naming[1..-1]
end
numbering_to_depth_max() click to toggle source
# 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_directory() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 82
def project_directory
  @project.working_directory
end
section_depth() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 87
def section_depth
  @numbering.length
end
source() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 92
def source
  File.read(source_filename_absolute)
end
source_file_does_exist() click to toggle source
# 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_exist() click to toggle source
# 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_absolute() click to toggle source
# 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_relative() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 112
def source_filename_relative
  source_filename
end
text_root_name() click to toggle source
# File lib/muwu/manifest_task/text_item.rb, line 117
def text_root_name
  @naming[0]
end