class DeepTest::Metrics::Gatherer
Public Class Methods
enabled?()
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 12 def self.enabled? return false unless $metrics_gatherer $metrics_gatherer.enabled? end
new(options)
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 21 def initialize(options) @options = options @sections = [] end
section(title, &block)
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 17 def self.section(title, &block) $metrics_gatherer.section(title, &block) end
setup(options)
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 4 def self.setup(options) $metrics_gatherer = new(options) at_exit do $metrics_gatherer.write_file end end
Public Instance Methods
enabled?()
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 26 def enabled? !@options.metrics_file.nil? end
render()
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 34 def render @sections.map {|s| s.render}.join("\n") end
section(title, &block)
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 30 def section(title, &block) @sections << Section.new(title, &block) if enabled? end
write_file()
click to toggle source
# File lib/deep_test/metrics/gatherer.rb, line 38 def write_file return unless enabled? File.open(@options.metrics_file, "w") do |io| io << render end end