Sha256: f7b7c7054ef56532cb77fed8b275b2ea131ae555c40484a02b00df06bd239be9
Contents?: true
Size: 615 Bytes
Versions: 5
Compression:
Stored size: 615 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 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
5 entries across 5 versions & 1 rubygems