Sha256: bab42bb0e98fa0fdbb92950e493cccce7514a4b910f0834226b201f374ac0fb7

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 KB

Contents

require 'active_support/dependencies'
require 'active_support/descendants_tracker'

require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/module/delegation'

module Keymap

  class Base
    ##
    # :singleton-method:
    # Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class,
    # which is then passed on to any new database connections made and which can be retrieved on both
    # a class and instance level by calling +logger+.
    cattr_accessor :logger, :instance_writer => false

    ##
    # :singleton-method:
    # Contains the database configuration - as is typically stored in config/database.yml -
    # as a Hash.
    #
    # For example, the following database.yml...
    #
    #   development:
    #     adapter: redis
    #
    #   production:
    #     adapter: redis
    #
    # ...would result in Keymap::Base.configurations to look like this:
    #
    #   {
    #      'development' => {
    #         'adapter'  => 'redis',
    #      },
    #      'production' => {
    #         'adapter'  => 'redis',
    #      }
    #   }
    cattr_accessor :configurations, :instance_writer => false
    @@configurations = {}

    public

    def initialize(attributes = nil, options = {})
      yield self if block_given?
      #run_callbacks :initialize
    end

    private

    extend ActiveSupport::DescendantsTracker

    include ActiveSupport::Callbacks

  end
end
require 'keymap/connection_adapters/abstract/connection_specification'
ActiveSupport.run_load_hooks(:keymap, Keymap::Base)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keymap-0.3.2 lib/keymap/base.rb
keymap-0.3.1 lib/keymap/base.rb
keymap-0.3.0 lib/keymap/base.rb
keymap-0.2.0 lib/keymap/base.rb