Class: PulseMeter::Visualize::Layout
- Inherits:
-
Object
- Object
- PulseMeter::Visualize::Layout
- Defined in:
- lib/pulse-meter/visualize/layout.rb
Instance Attribute Summary collapse
-
#highchart_options ⇒ Object
readonly
Returns the value of attribute highchart_options.
-
#outlier_color ⇒ Object
readonly
Returns the value of attribute outlier_color.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#use_utc ⇒ Object
readonly
Returns the value of attribute use_utc.
Instance Method Summary collapse
-
#initialize(args) ⇒ Layout
constructor
A new instance of Layout.
- #options ⇒ Object
- #page_infos ⇒ Object
- #to_app ⇒ Object
- #widget(page_id, widget_id) ⇒ Object
- #widgets(page_id) ⇒ Object
Constructor Details
#initialize(args) ⇒ Layout
Returns a new instance of Layout.
11 12 13 14 15 16 17 18 |
# File 'lib/pulse-meter/visualize/layout.rb', line 11 def initialize(args) raise ArgumentError unless args.respond_to?('[]') @title = args[:title] or raise ArgumentError, ":title not specified" @pages = args[:pages] or raise ArgumentError, ":pages not specified" @use_utc = args[:use_utc] @outlier_color = args[:outlier_color] @highchart_options = args[:highchart_options] end |
Instance Attribute Details
#highchart_options ⇒ Object (readonly)
Returns the value of attribute highchart_options.
9 10 11 |
# File 'lib/pulse-meter/visualize/layout.rb', line 9 def @highchart_options end |
#outlier_color ⇒ Object (readonly)
Returns the value of attribute outlier_color.
8 9 10 |
# File 'lib/pulse-meter/visualize/layout.rb', line 8 def outlier_color @outlier_color end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
4 5 6 |
# File 'lib/pulse-meter/visualize/layout.rb', line 4 def pages @pages end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/pulse-meter/visualize/layout.rb', line 6 def title @title end |
#use_utc ⇒ Object (readonly)
Returns the value of attribute use_utc.
7 8 9 |
# File 'lib/pulse-meter/visualize/layout.rb', line 7 def use_utc @use_utc end |
Instance Method Details
#options ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/pulse-meter/visualize/layout.rb', line 36 def { use_utc: @use_utc, outlier_color: @outlier_color, highchart_options: @highchart_options } end |
#page_infos ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pulse-meter/visualize/layout.rb', line 24 def page_infos res = [] pages.each_with_index do |p, i| res << { id: i + 1, title: p.title, highchart_options: p. } end res end |
#to_app ⇒ Object
20 21 22 |
# File 'lib/pulse-meter/visualize/layout.rb', line 20 def to_app PulseMeter::Visualize::App.new(self) end |
#widget(page_id, widget_id) ⇒ Object
44 45 46 |
# File 'lib/pulse-meter/visualize/layout.rb', line 44 def (page_id, ) pages[page_id].() end |
#widgets(page_id) ⇒ Object
48 49 50 |
# File 'lib/pulse-meter/visualize/layout.rb', line 48 def (page_id) pages[page_id]. end |