Class: Barnes::Panel

Inherits:
Object
  • Object
show all
Defined in:
lib/barnes/panel.rb

Direct Known Subclasses

ResourceUsage

Instance Method Summary collapse

Constructor Details

#initializePanel

Returns a new instance of Panel.



26
27
28
# File 'lib/barnes/panel.rb', line 26

def initialize
  @instruments = []
end

Instance Method Details

#instrument(instrument) ⇒ Object

Add an instrument to the Panel



31
32
33
# File 'lib/barnes/panel.rb', line 31

def instrument(instrument)
  @instruments << instrument
end

#instrument!(state, counter_readings, gauge_readings) ⇒ Object

Read the values of each instrument into counter_readings, and gauge_readings. May have side effects on all arguments.



44
45
46
47
48
# File 'lib/barnes/panel.rb', line 44

def instrument!(state, counter_readings, gauge_readings)
  @instruments.each do |ins|
    ins.instrument! state, counter_readings, gauge_readings
  end
end

#start!(state) ⇒ Object

Initialize the state of each instrument in the panel.



36
37
38
39
40
# File 'lib/barnes/panel.rb', line 36

def start!(state)
  @instruments.each do |ins|
    ins.start! state if ins.respond_to?(:start!)
  end
end