Sha256: b62d115063eed7bbc68c556b56988b3f0a32060f562849c5cc05e1c13058f792
Contents?: true
Size: 671 Bytes
Versions: 12
Compression:
Stored size: 671 Bytes
Contents
class FnordMetric::Dashboard attr_accessor :widgets def initialize(options={}) raise "please provide a :title" unless options[:title] @widgets = Array.new @options = options end def add_widget(w) @widgets << w end def title @options[:title] end def group @options[:group] || "Dashboards" end def token token = title.to_s.gsub(/[\W]/, '') token = Digest::SHA1.hexdigest(title.to_s) if token.empty? token end def to_json { :title => title, :widgets => {}.tap { |wids| @widgets.each do |w| wids[w.token] = w.render end } }.to_json end end
Version data entries
12 entries across 12 versions & 3 rubygems