Sha256: 83abc99072da63948d881a58d810f3f0878af320e4e2b03d3ad6d7786449043e

Contents?: true

Size: 534 Bytes

Versions: 17

Compression:

Stored size: 534 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
    title.to_s.gsub(/[\W]/, '')
  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

17 entries across 17 versions & 1 rubygems

Version Path
fnordmetric-0.6.6 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.5 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.4 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.3 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.2 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.1 lib/fnordmetric/dashboard.rb
fnordmetric-0.6.0 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.9 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.8 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.7 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.6 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.5 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.4 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.3 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.2 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.1 lib/fnordmetric/dashboard.rb
fnordmetric-0.5.0 lib/fnordmetric/dashboard.rb