Class: LazyHighCharts::HighChartGlobals

Inherits:
Object
  • Object
show all
Includes:
LayoutHelper
Defined in:
lib/lazy_high_charts/high_chart_globals.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LayoutHelper

#high_chart, #high_chart_globals, #high_graph, #high_graph_stock, #high_stock

Constructor Details

#initializeHighChartGlobals

Returns a new instance of HighChartGlobals.



7
8
9
10
11
12
# File 'lib/lazy_high_charts/high_chart_globals.rb', line 7

def initialize
  self.tap do |chart_globals|
     chart_globals.options ||= {}
     yield chart_globals if block_given?
   end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, opts = {}) ⇒ Object

For instance: high_chart_globals.global(:useUTC => false)



17
18
19
20
21
22
# File 'lib/lazy_high_charts/high_chart_globals.rb', line 17

def method_missing(meth, opts = {})
  if meth.to_s == 'to_ary'
    super
  end
  merge_options meth, opts      
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/lazy_high_charts/high_chart_globals.rb', line 5

def options
  @options
end

Instance Method Details

#merge_options(name, opts) ⇒ Object



24
25
26
# File 'lib/lazy_high_charts/high_chart_globals.rb', line 24

def merge_options(name, opts)
  @options.merge! name => opts
end