Class: Muwu::ManifestTask::Topic

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/manifest_task/topic.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/topic.rb', line 9

def destination
  @destination
end

#headingObject

Returns the value of attribute heading.



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

def heading
  @heading
end

#heading_originObject

Returns the value of attribute heading_origin.



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

def heading_origin
  @heading_origin
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#namingObject

Returns the value of attribute naming.



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

def naming
  @naming
end

#numberingObject

Returns the value of attribute numbering.



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

def numbering
  @numbering
end

#outlineObject

Returns the value of attribute outline.



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

def outline
  @outline
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#source_filenameObject

Returns the value of attribute source_filename.



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

def source_filename
  @source_filename
end

Instance Method Details

#depthObject



37
38
39
# File 'lib/muwu/manifest_task/topic.rb', line 37

def depth
  numbering.length
end

#does_have_subtopicsObject



42
43
44
# File 'lib/muwu/manifest_task/topic.rb', line 42

def does_have_subtopics
  is_parent_heading && (@subtopics.length >= 1)
end

#inspectObject



23
24
25
# File 'lib/muwu/manifest_task/topic.rb', line 23

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

#inspect_instance_variablesObject



28
29
30
# File 'lib/muwu/manifest_task/topic.rb', line 28

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

#is_distinctObject



47
48
49
50
51
52
53
54
55
# File 'lib/muwu/manifest_task/topic.rb', line 47

def is_distinct
  if project.options.topic_depth_max == nil
    true
  elsif depth <= project.options.topic_depth_max
    true
  elsif depth > project.options.topic_depth_max
    false
  end
end

#is_not_parent_headingObject



58
59
60
# File 'lib/muwu/manifest_task/topic.rb', line 58

def is_not_parent_heading
  is_parent_heading == false
end

#is_parent_headingObject



63
64
65
# File 'lib/muwu/manifest_task/topic.rb', line 63

def is_parent_heading
  Array === @subtopics
end

#naming_downcaseObject



68
69
70
# File 'lib/muwu/manifest_task/topic.rb', line 68

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

#naming_downcase_without_text_rootObject



73
74
75
# File 'lib/muwu/manifest_task/topic.rb', line 73

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

#naming_without_text_rootObject



78
79
80
# File 'lib/muwu/manifest_task/topic.rb', line 78

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

#numbering_for_displayObject



98
99
100
# File 'lib/muwu/manifest_task/topic.rb', line 98

def numbering_for_display
  numbering_to_depth_max.join('.')
end

#numbering_to_depth_maxObject



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/muwu/manifest_task/topic.rb', line 83

def numbering_to_depth_max
  if @project.options.topic_depth_max
    index_min = 0
    index_max = @project.options.topic_depth_max - 1
    if index_max >= index_min
      @numbering[index_min..index_max]
    else
      @numbering
    end
  else
    @numbering
  end
end

#project_directoryObject



103
104
105
# File 'lib/muwu/manifest_task/topic.rb', line 103

def project_directory
  @project.working_directory
end

#sourceObject



113
114
115
# File 'lib/muwu/manifest_task/topic.rb', line 113

def source
  File.read(source_filename_absolute)
end

#source_file_does_existObject



118
119
120
# File 'lib/muwu/manifest_task/topic.rb', line 118

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

#source_file_does_not_existObject



123
124
125
# File 'lib/muwu/manifest_task/topic.rb', line 123

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

#source_filename_absoluteObject



128
129
130
# File 'lib/muwu/manifest_task/topic.rb', line 128

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

#source_filename_relativeObject



133
134
135
# File 'lib/muwu/manifest_task/topic.rb', line 133

def source_filename_relative
  source_filename
end

#text_root_nameObject



138
139
140
# File 'lib/muwu/manifest_task/topic.rb', line 138

def text_root_name
  @naming[0]
end

#topic_depthObject



108
109
110
# File 'lib/muwu/manifest_task/topic.rb', line 108

def topic_depth
  @numbering.length
end