class Hive::Results
Attributes
timestamp[R]
Public Class Methods
new( state, message, data = {}, hive_mind=nil)
click to toggle source
# File lib/hive/results.rb, line 4 def initialize( state, message, data = {}, hive_mind=nil) @state = state @message = message @data = data @timestamp = Time.now @hive_mind = hive_mind submit_results end
Public Instance Methods
failed?()
click to toggle source
# File lib/hive/results.rb, line 13 def failed? @state == 'fail' end
formulate_results()
click to toggle source
# File lib/hive/results.rb, line 21 def formulate_results result = [] h = {} @data.each do |k,v| h[:label] = k.to_s h[:unit] = v[:unit] || nil if v[:value].instance_of?(Time) h[:value] = v[:value].to_i h[:format] = 'timestamp' else h[:value] = v[:value] h[:format] = 'integer' end result << h h = {} end result end
passed?()
click to toggle source
# File lib/hive/results.rb, line 17 def passed? @state == 'pass' end
submit_results()
click to toggle source
# File lib/hive/results.rb, line 40 def submit_results if @hive_mind @hive_mind.add_statistics(formulate_results) @hive_mind.flush_statistics end end