Class: SAAL::Charts

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/charts.rb

Instance Method Summary collapse

Constructor Details

#initialize(conffile = SAAL::CHARTSCONF, opts = {}) ⇒ Charts

Returns a new instance of Charts.



5
6
7
8
9
10
11
12
# File 'lib/charts.rb', line 5

def initialize(conffile=SAAL::CHARTSCONF, opts={})
  @defs = YAML::load(File.new(conffile))
  @sensors = opts[:sensors] || Sensors.new
  @charts = {}
  @defs.each do |name, defs|
    @charts[name.to_sym] = Chart.new(name, defs, @sensors, opts)
  end  
end

Instance Method Details

#eachObject



19
20
21
# File 'lib/charts.rb', line 19

def each
  @charts.each{|name, chart| yield chart}
end

#find(name) ⇒ Object

Fetch a specific chart by name



15
16
17
# File 'lib/charts.rb', line 15

def find(name)
  @charts[name.to_sym]
end