Class: Appboard::DashboardSetup::Widget
- Inherits:
-
Object
- Object
- Appboard::DashboardSetup::Widget
- Defined in:
- lib/appboard/dashboardsetup.rb
Overview
Defines widget
Instance Method Summary collapse
- #data(&block) ⇒ Object
- #get_data ⇒ Object
-
#initialize(name, &block) ⇒ Widget
constructor
A new instance of Widget.
- #name ⇒ Object
- #size(value = nil) ⇒ Object
- #to_json(*a) ⇒ Object
- #type(value = nil) ⇒ Object
- #uid(value = nil) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Widget
Returns a new instance of Widget.
86 87 88 89 |
# File 'lib/appboard/dashboardsetup.rb', line 86 def initialize(name, &block) @name = name instance_eval(&block) end |
Instance Method Details
#data(&block) ⇒ Object
110 111 112 113 |
# File 'lib/appboard/dashboardsetup.rb', line 110 def data(&block) @data = block if block_given? @data end |
#get_data ⇒ Object
115 116 117 |
# File 'lib/appboard/dashboardsetup.rb', line 115 def get_data @data.call() end |
#name ⇒ Object
91 92 93 |
# File 'lib/appboard/dashboardsetup.rb', line 91 def name @name end |
#size(value = nil) ⇒ Object
105 106 107 108 |
# File 'lib/appboard/dashboardsetup.rb', line 105 def size(value = nil) @size = value unless value.nil? @size end |
#to_json(*a) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/appboard/dashboardsetup.rb', line 119 def to_json(*a) { :name => @name, :type => @type, :size => @size }.to_json(*a) end |
#type(value = nil) ⇒ Object
100 101 102 103 |
# File 'lib/appboard/dashboardsetup.rb', line 100 def type(value = nil) @type = value unless value.nil? @type end |
#uid(value = nil) ⇒ Object
95 96 97 98 |
# File 'lib/appboard/dashboardsetup.rb', line 95 def uid(value = nil) @uid = value unless value.nil? @uid end |