Sha256: 0a88303aa516d1c7e6e2b32cc70ebaa36f68b52973b9ecb8506125116a3919e6

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

module Kin
  ##
  # Provides a wrapper around Configatron, adding #configure and #config
  # methods to extended modules.
  #
  # @example
  #   module MyApplication
  #     extend Kin::Configurable
  #   end
  #
  module Configurable
    def self.extended(*args)
      # Load configatron on-demand.
      require 'configatron'
    end

    ##
    # Provides a handy block notation for configuring your app/object.
    #
    # @yield [Configatron::Store] The config object.
    #
    # @example
    #   MyObj.configure do |c|
    #     c.auth.site_key = 'a8ecf9ac57d287e41'
    #   end
    #
    def configure
      yield config
    end

    ##
    # Returns the configuration.
    #
    # @return [Configatron::Store]
    #
    def config
      @@_config ||= Configatron::Store.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
antw-kin-0.3.2 lib/kin/configurable.rb
antw-kin-0.3.3 lib/kin/configurable.rb
antw-kin-0.4.0 lib/kin/configurable.rb
antw-kin-0.4.1 lib/kin/configurable.rb