Class: PulseMeter::Visualize::Page
- Inherits:
-
Object
- Object
- PulseMeter::Visualize::Page
- Defined in:
- lib/pulse-meter/visualize/page.rb
Instance Attribute Summary collapse
-
#highchart_options ⇒ Object
readonly
Returns the value of attribute highchart_options.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#widgets ⇒ Object
readonly
Returns the value of attribute widgets.
Instance Method Summary collapse
-
#initialize(args) ⇒ Page
constructor
A new instance of Page.
- #widget_data(widget_id) ⇒ Object
- #widget_datas ⇒ Object
Constructor Details
#initialize(args) ⇒ Page
Returns a new instance of Page.
8 9 10 11 12 13 |
# File 'lib/pulse-meter/visualize/page.rb', line 8 def initialize(args) raise ArgumentError unless args.respond_to?('[]') @title = args[:title] or raise ArgumentError, ":title not specified" @widgets = args[:widgets] or raise ArgumentError, ":widgets not specified" @highchart_options = args[:highchart_options] or raise ArgumentError, ":highchart_options not specified" end |
Instance Attribute Details
#highchart_options ⇒ Object (readonly)
Returns the value of attribute highchart_options.
6 7 8 |
# File 'lib/pulse-meter/visualize/page.rb', line 6 def @highchart_options end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/pulse-meter/visualize/page.rb', line 5 def title @title end |
#widgets ⇒ Object (readonly)
Returns the value of attribute widgets.
4 5 6 |
# File 'lib/pulse-meter/visualize/page.rb', line 4 def @widgets end |
Instance Method Details
#widget_data(widget_id) ⇒ Object
15 16 17 |
# File 'lib/pulse-meter/visualize/page.rb', line 15 def () [].data.merge(id: + 1) end |
#widget_datas ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pulse-meter/visualize/page.rb', line 19 def res = [] .each_with_index do |w, i| res << w.data.merge(id: i + 1) end res end |