Module: GraphiteDashboardApi::ExtraOptions

Included in:
Graph
Defined in:
lib/graphite-dashboard-api/extra_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



4
5
6
7
8
9
# File 'lib/graphite-dashboard-api/extra_options.rb', line 4

def method_missing(m, *args)
  if args && args.size > 0
    @extra_options[m.to_s] = args[0]
  end
  @extra_options[m.to_s]
end

Instance Attribute Details

#extra_optionsObject

Returns the value of attribute extra_options.



3
4
5
# File 'lib/graphite-dashboard-api/extra_options.rb', line 3

def extra_options
  @extra_options
end

Instance Method Details

#extra_options_from_hash!(std_options, hash) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/graphite-dashboard-api/extra_options.rb', line 19

def extra_options_from_hash!(std_options, hash)
  extra_options = hash.keys - std_options
  extra_options.each do |k|
    @extra_options[k] = hash[k]
  end
  self
end

#extra_options_to_hashObject



11
12
13
14
15
16
17
# File 'lib/graphite-dashboard-api/extra_options.rb', line 11

def extra_options_to_hash
  hash = {}
  @extra_options.each do |k,v|
    hash[k.to_s] = v
  end
  hash
end