Class: Result
- Inherits:
-
Object
- Object
- Result
- Defined in:
- lib/benchify/result.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#middle ⇒ Object
readonly
Returns the value of attribute middle.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#msg ⇒ Object
(also: #message)
readonly
Returns the value of attribute msg.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #add(start, ends) ⇒ Object
- #create_result_message ⇒ Object
- #get ⇒ Object
-
#initialize(type, message) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(type, message) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 |
# File 'lib/benchify/result.rb', line 8 def initialize( type, ) @type = type.to_sym @msg = @all = [] end |
Instance Attribute Details
#all ⇒ Object (readonly)
Returns the value of attribute all.
4 5 6 |
# File 'lib/benchify/result.rb', line 4 def all @all end |
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
3 4 5 |
# File 'lib/benchify/result.rb', line 3 def counter @counter end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
4 5 6 |
# File 'lib/benchify/result.rb', line 4 def max @max end |
#middle ⇒ Object (readonly)
Returns the value of attribute middle.
4 5 6 |
# File 'lib/benchify/result.rb', line 4 def middle @middle end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
4 5 6 |
# File 'lib/benchify/result.rb', line 4 def min @min end |
#msg ⇒ Object (readonly) Also known as: message
Returns the value of attribute msg.
3 4 5 |
# File 'lib/benchify/result.rb', line 3 def msg @msg end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
3 4 5 |
# File 'lib/benchify/result.rb', line 3 def output @output end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/benchify/result.rb', line 3 def type @type end |
Instance Method Details
#add(start, ends) ⇒ Object
14 15 16 17 |
# File 'lib/benchify/result.rb', line 14 def add( start, ends ) time = ends.to_f - start.to_f @all << time end |
#create_result_message ⇒ Object
27 28 29 30 31 |
# File 'lib/benchify/result.rb', line 27 def msg = @msg.to_s msg += " => " msg += "min: #{@min} #{@type} | max: #{@max} #{@type} | middle: #{@middle} #{@type}" end |
#get ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/benchify/result.rb', line 19 def get @counter = @all.size @min = get_by_type @all.min @max = get_by_type @all.max @middle = get_by_type ( @max - ( (@max - @min) / 2 ) ) @output = end |