Module: Kin::Configurable

Defined in:
lib/kin/configurable.rb

Overview

Provides a wrapper around Configatron, adding #configure and #config methods to extended modules.

Examples:

module MyApplication
  extend Kin::Configurable
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(*args) ⇒ Object



12
13
14
15
# File 'lib/kin/configurable.rb', line 12

def self.extended(*args)
  # Load configatron on-demand.
  require 'configatron'
end

Instance Method Details

#configConfigatron::Store

Returns the configuration.



36
37
38
# File 'lib/kin/configurable.rb', line 36

def config
  @@_config ||= Configatron::Store.new
end

#configure {|Configatron::Store| ... } ⇒ Object

Provides a handy block notation for configuring your app/object.

Examples:

MyObj.configure do |c|
  c.auth.site_key = 'a8ecf9ac57d287e41'
end

Yields:

  • (Configatron::Store)

    The config object.



27
28
29
# File 'lib/kin/configurable.rb', line 27

def configure
  yield config
end