Method: Pencil::Models::Dashboard#initialize
- Defined in:
- lib/pencil/models/dashboard.rb
#initialize(name, params = {}) ⇒ Dashboard
Returns a new instance of Dashboard.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pencil/models/dashboard.rb', line 12 def initialize(name, params={}) super @graphs = [] @graph_opts = {} params["graphs"].each do |n| if n.respond_to?(:keys) key = n.keys.first # should only be one key val = n.values.first g = Graph.find(key) @graph_opts[g] = val||{} else raise "Bad format for graph (must be a hash-y; #{n.class}:#{n.inspect} is not)" end @graphs << g if g end @valid_hosts_table = {} # cache calls to get_valid_hosts end |