Sha256: b84a162fa58ec5ac5937df8aaf642a9049c6f3b62ea53b0738b0e132278a1ced

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

require 'active_model'
require 'active_support/core_ext/hash/indifferent_access'
require 'singleton'
require 'configure_me/persistence'
require 'configure_me/caching'
require 'configure_me/settings'
require 'configure_me/nesting'

module ConfigureMe
  class Base
    include ActiveModel::AttributeMethods
    include Settings
    include Persistence
    include Caching
    include Nesting
    include Singleton
    extend ActiveModel::Naming

    class << self
      def config_name
        self.name.split('::').last.gsub(/^(.*)Config$/, '\1').downcase
      end
    end

    def parent
      @parent || nil
    end

    def parent=(parent)
      @parent = parent
    end

    def initialize
      @children = {}
      @settings = settings_from_class_settings
      self.class.nested.each do |klass|
        nest(klass)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
configure_me-0.2.1 lib/configure_me/base.rb