Module: FitbitAPI::Configuration

Included in:
FitbitAPI
Defined in:
lib/fitbit_api/helpers/configuration.rb

Instance Method Summary collapse

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



5
6
7
# File 'lib/fitbit_api/helpers/configuration.rb', line 5

def configure
  yield self
end

#define_setting(name, default = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fitbit_api/helpers/configuration.rb', line 9

def define_setting(name, default = nil)
  instance_variable_set("@#{name}", default)

  define_singleton_method("#{name}=") do |value|
    instance_variable_set("@#{name}", value)
  end

  define_singleton_method(name) do
    instance_variable_get("@#{name}")
  end
end