Class: Cauldron::History
- Inherits:
-
Object
- Object
- Cauldron::History
- Defined in:
- lib/cauldron/history.rb
Instance Attribute Summary collapse
-
#logs ⇒ Object
readonly
Returns the value of attribute logs.
Instance Method Summary collapse
-
#initialize(logs) ⇒ History
constructor
A new instance of History.
- #insert_points ⇒ Object
- #values(variable_name) ⇒ Object
- #variables ⇒ Object
Constructor Details
#initialize(logs) ⇒ History
Returns a new instance of History.
7 8 9 |
# File 'lib/cauldron/history.rb', line 7 def initialize(logs) @logs = logs end |
Instance Attribute Details
#logs ⇒ Object (readonly)
Returns the value of attribute logs.
5 6 7 |
# File 'lib/cauldron/history.rb', line 5 def logs @logs end |
Instance Method Details
#insert_points ⇒ Object
28 29 30 |
# File 'lib/cauldron/history.rb', line 28 def insert_points logs.collect {|x| x[:point] }.uniq end |
#values(variable_name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/cauldron/history.rb', line 19 def values(variable_name) @logs.inject([]) do |total,line| if line.has_key?(variable_name) total << line[variable_name] end total end end |
#variables ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cauldron/history.rb', line 11 def variables results = [] @logs.select do |line| results += line.keys.select {|x| x.match(/var*/) } end results end |