Sha256: 47758c165ee662ae9f6cd1c68d38130539c05bc2df3fd3074d7451dead2a293d

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

module Firefly
  class Config < Hash
    
    DEFAULTS = {
      :hostname   => "localhost:3000",
      :api_key    => "test",
      :database   => "sqlite3://#{Dir.pwd}/firefly_#{ENV['RACK_ENV']}.sqlite3"
    }
    
    def initialize obj
      self.update DEFAULTS
      self.update obj
    end    
    
    def set key, val = nil, &blk
      if val.is_a? Hash
        self[key].update val
      else
        self[key] = block_given?? blk : val
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
firefly-0.2.0 lib/firefly/config.rb
firefly-0.1.0 lib/firefly/config.rb