Class: ActsAsDashboard::Widget

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_dashboard/widget.rb

Direct Known Subclasses

LineGraphWidget, ShortMessagesWidget

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Widget

Returns a new instance of Widget.



9
10
11
12
13
14
15
# File 'lib/acts_as_dashboard/widget.rb', line 9

def initialize(options = {})
  self.type             = options[:type]            if options[:type]
  self.name             = options[:name]            if options[:name]
  self.title            = options[:title]           if options[:title]
  self.block            = options[:block]           if options[:block]
  self.update_interval  = options[:update_interval] if options[:update_interval]
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



6
7
8
# File 'lib/acts_as_dashboard/widget.rb', line 6

def block
  @block
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/acts_as_dashboard/widget.rb', line 4

def name
  @name
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/acts_as_dashboard/widget.rb', line 5

def title
  @title
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/acts_as_dashboard/widget.rb', line 3

def type
  @type
end

#update_intervalObject

Returns the value of attribute update_interval.



7
8
9
# File 'lib/acts_as_dashboard/widget.rb', line 7

def update_interval
  @update_interval
end

Instance Method Details

#attributesObject



46
47
48
49
50
51
52
53
# File 'lib/acts_as_dashboard/widget.rb', line 46

def attributes
  {
    :type             => @type,
    :name             => @name,
    :title            => @title,
    :update_interval  => @update_interval,
  }
end

#data(&block) ⇒ Object



37
38
39
# File 'lib/acts_as_dashboard/widget.rb', line 37

def data(&block)
  self.block = block
end