Class: Muwu::ManifestTask::Topic
- Inherits:
-
Object
- Object
- Muwu::ManifestTask::Topic
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
#destination ⇒ Object
Returns the value of attribute destination.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def destination
@destination
end
|
#heading ⇒ Object
Returns the value of attribute heading.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def heading
@heading
end
|
#heading_origin ⇒ Object
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
|
#id ⇒ Object
Returns the value of attribute id.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def id
@id
end
|
#naming ⇒ Object
Returns the value of attribute naming.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def naming
@naming
end
|
#numbering ⇒ Object
Returns the value of attribute numbering.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def numbering
@numbering
end
|
#outline ⇒ Object
Returns the value of attribute outline.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def outline
@outline
end
|
#project ⇒ Object
Returns the value of attribute project.
9
10
11
|
# File 'lib/muwu/manifest_task/topic.rb', line 9
def project
@project
end
|
#source_filename ⇒ Object
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
#depth ⇒ Object
37
38
39
|
# File 'lib/muwu/manifest_task/topic.rb', line 37
def depth
numbering.length
end
|
#does_have_subtopics ⇒ Object
42
43
44
|
# File 'lib/muwu/manifest_task/topic.rb', line 42
def does_have_subtopics
is_parent_heading && (@subtopics.length >= 1)
end
|
#inspect ⇒ Object
23
24
25
|
# File 'lib/muwu/manifest_task/topic.rb', line 23
def inspect
["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
end
|
#inspect_instance_variables ⇒ Object
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_distinct ⇒ Object
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_heading ⇒ Object
58
59
60
|
# File 'lib/muwu/manifest_task/topic.rb', line 58
def is_not_parent_heading
is_parent_heading == false
end
|
#is_parent_heading ⇒ Object
63
64
65
|
# File 'lib/muwu/manifest_task/topic.rb', line 63
def is_parent_heading
Array === @subtopics
end
|
#naming_downcase ⇒ Object
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_root ⇒ Object
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_root ⇒ Object
78
79
80
|
# File 'lib/muwu/manifest_task/topic.rb', line 78
def naming_without_text_root
@naming[1..-1]
end
|
#numbering_for_display ⇒ Object
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_max ⇒ Object
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_directory ⇒ Object
103
104
105
|
# File 'lib/muwu/manifest_task/topic.rb', line 103
def project_directory
@project.working_directory
end
|
#source ⇒ Object
113
114
115
|
# File 'lib/muwu/manifest_task/topic.rb', line 113
def source
File.read(source_filename_absolute)
end
|
#source_file_does_exist ⇒ Object
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_exist ⇒ Object
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_absolute ⇒ Object
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_relative ⇒ Object
133
134
135
|
# File 'lib/muwu/manifest_task/topic.rb', line 133
def source_filename_relative
source_filename
end
|
#text_root_name ⇒ Object
138
139
140
|
# File 'lib/muwu/manifest_task/topic.rb', line 138
def text_root_name
@naming[0]
end
|
#topic_depth ⇒ Object
108
109
110
|
# File 'lib/muwu/manifest_task/topic.rb', line 108
def topic_depth
@numbering.length
end
|