Module: Rapnd::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/rapnd/config.rb

Instance Method Summary collapse

Instance Method Details

#defaultsObject



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

def defaults
  @defaults ||= {}
end

#option(name, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rapnd/config.rb', line 5

def option(name, options = {})
  defaults[name] = settings[name] = options[:default]

  class_eval <<-RUBY
    def #{name}
      settings[#{name.inspect}]
    end

    def #{name}=(value)
      settings[#{name.inspect}] = value
    end

    def #{name}?
      #{name}
    end
  RUBY
end

#settingsObject



27
28
29
# File 'lib/rapnd/config.rb', line 27

def settings
  @settings ||= {}
end