Class: Cuporter::ReportBase
- Inherits:
-
Object
- Object
- Cuporter::ReportBase
show all
- Defined in:
- lib/cuporter/report/report_base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ ReportBase
Returns a new instance of ReportBase.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/cuporter/report/report_base.rb', line 7
def initialize(options)
@input_file_pattern = options[:input_file_pattern]
@doc = Cuporter::Document.new_xml
@view = options[:report]
@root_dir = options[:root_dir]
@filter = Filter.new(options[:filter_args])
@title = options[:title]
@sort = options[:sort]
@total = options[:total]
@number = options[:number]
@leaves = options[:leaves]
@show_files = options[:show_files]
@show_tags = options[:show_tags]
end
|
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
5
6
7
|
# File 'lib/cuporter/report/report_base.rb', line 5
def doc
@doc
end
|
#filter ⇒ Object
Returns the value of attribute filter.
5
6
7
|
# File 'lib/cuporter/report/report_base.rb', line 5
def filter
@filter
end
|
#root_dir ⇒ Object
Returns the value of attribute root_dir.
5
6
7
|
# File 'lib/cuporter/report/report_base.rb', line 5
def root_dir
@root_dir
end
|
#view ⇒ Object
Returns the value of attribute view.
5
6
7
|
# File 'lib/cuporter/report/report_base.rb', line 5
def view
@view
end
|
Class Method Details
.create(options) ⇒ Object
50
51
52
53
|
# File 'lib/cuporter/report/report_base.rb', line 50
def self.create(options)
klass = Cuporter.const_get("#{options[:report].downcase}Report".to_class_name)
klass.new(options)
end
|
Instance Method Details
#build ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/cuporter/report/report_base.rb', line 55
def build
report_node.sort_all_descendants! if sort?
report_node.number_all_descendants if number?
report_node.total if total?
report_node.defoliate! if no_leaves?
report_node.remove_files! unless show_files?
report_node.remove_tags! unless show_tags?
doc.add_filter_summary(@filter)
doc.add_report report_node
self
end
|
#files ⇒ Object
46
47
48
|
# File 'lib/cuporter/report/report_base.rb', line 46
def files
Dir[@input_file_pattern].collect {|f| File.expand_path f}
end
|
#no_leaves? ⇒ Boolean
22
23
24
|
# File 'lib/cuporter/report/report_base.rb', line 22
def no_leaves?
!@leaves
end
|
#number? ⇒ Boolean
34
35
36
|
# File 'lib/cuporter/report/report_base.rb', line 34
def number?
@number
end
|
#show_files? ⇒ Boolean
38
39
40
|
# File 'lib/cuporter/report/report_base.rb', line 38
def show_files?
@show_files
end
|
42
43
44
|
# File 'lib/cuporter/report/report_base.rb', line 42
def show_tags?
@show_tags
end
|
#sort? ⇒ Boolean
26
27
28
|
# File 'lib/cuporter/report/report_base.rb', line 26
def sort?
@sort
end
|
#total? ⇒ Boolean
30
31
32
|
# File 'lib/cuporter/report/report_base.rb', line 30
def total?
@total
end
|