Class: Cuenote::Api::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cuenote/api/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



7
8
9
# File 'lib/cuenote/api/config.rb', line 7

def initialize
  @config = CONFIG_DEFAULT.dup
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, value = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/cuenote/api/config.rb', line 11

def method_missing name, value=nil
  if value
    set name, value
  else
    get name
  end
end

Instance Method Details

#get(name) ⇒ Object



23
24
25
# File 'lib/cuenote/api/config.rb', line 23

def get name
  @config[name.to_sym]
end

#set(name, value) ⇒ Object



19
20
21
# File 'lib/cuenote/api/config.rb', line 19

def set name, value
  @config[name.to_sym] = value
end