Class: BigBench::PostProcessor::Graphs::PieGraph
- Inherits:
-
Object
- Object
- BigBench::PostProcessor::Graphs::PieGraph
- Defined in:
- lib/bigbench/post_processor/graphs.rb
Overview
Encapsules the gruff pie graph
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#labels ⇒ Object
Returns the value of attribute labels.
Instance Method Summary collapse
- #add(title, percentage) ⇒ Object
-
#initialize(title, options = {}) ⇒ PieGraph
constructor
A new instance of PieGraph.
- #open ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ PieGraph
Returns a new instance of PieGraph.
75 76 77 78 79 80 81 82 |
# File 'lib/bigbench/post_processor/graphs.rb', line 75 def initialize title, = {} @graph = Gruff::Pie.new([:size] || DEFAULT[:size]) @graph.title = title @graph.theme = [:theme] || DEFAULT[:theme] @folder = [:folder] || DEFAULT[:folder] Dir.mkdir @folder unless File.directory?(@folder) end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
72 73 74 |
# File 'lib/bigbench/post_processor/graphs.rb', line 72 def graph @graph end |
#labels ⇒ Object
Returns the value of attribute labels.
73 74 75 |
# File 'lib/bigbench/post_processor/graphs.rb', line 73 def labels @labels end |
Instance Method Details
#add(title, percentage) ⇒ Object
84 85 86 |
# File 'lib/bigbench/post_processor/graphs.rb', line 84 def add title, percentage @graph.data(title, percentage) end |
#open ⇒ Object
93 94 95 |
# File 'lib/bigbench/post_processor/graphs.rb', line 93 def open `open #{File.join(@folder, @file)}` end |
#write(file) ⇒ Object
88 89 90 91 |
# File 'lib/bigbench/post_processor/graphs.rb', line 88 def write file puts "Writing Graph to #{File.join(@folder, @file = file)}" @graph.write File.join(@folder, @file = file) end |