Sha256: 2c00b6448f97f46bb9974d114102c1e0fc9de19fc6806d0e68312e583ffa6257

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 Bytes

Contents

module Alfa
  class Config < ::Hash

    def initialize
      self[:db] = {}
      self[:log] = {}
      self[:session] = {key: 'session', secret: nil}
    end

    def []=(key, value)
      if [:db, :log, :session].include? key
        raise "key :#{key} should include Enumerable" unless value.class.included_modules.include? Enumerable
      end
      super
    end

    def store(key, value)
      if [:db, :log, :session].include? key
        raise "key :#{key} should include Enumerable" unless value.class.included_modules.include? Enumerable
      end
      super
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alfa-0.0.8.pre lib/alfa/config.rb
alfa-0.0.7.pre lib/alfa/config.rb
alfa-0.0.6.pre lib/alfa/config.rb