Module: LazyHighCharts::OptionsKeyFilter

Defined in:
lib/lazy_high_charts/options_key_filter.rb

Constant Summary collapse

FILTER_MAP =
{
  :data => [:format_data],
  :pointInterval => [:milliseconds],
  :pointStart => [:date_to_js_code]
}

Class Method Summary collapse

Class Method Details

.filter(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/lazy_high_charts/options_key_filter.rb', line 16

def filter options
  {}.tap do |hash|
    options.each do |key, value|
      if value.is_a?(::Hash)
        hash[key] = filter(value)
      else
        hash[key] = value
        methods = Array(FILTER_MAP[key])
        methods.each do |method_name|
          hash[key] = send(method_name, hash[key])
        end
      end
    end
  end
end