Class: SAAL::Charts
Instance Method Summary collapse
- #each ⇒ Object
-
#find(name) ⇒ Object
Fetch a specific chart by name.
-
#initialize(conffile = SAAL::CHARTSCONF, opts = {}) ⇒ Charts
constructor
A new instance of Charts.
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
#each ⇒ Object
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 |