Class: Firefly::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/tmin/config.rb

Constant Summary collapse

DEFAULTS =
{
  :hostname         => "localhost:3000",
  :api_key          => "test",
  :database         => "sqlite3://#{Dir.pwd}/firefly_#{ENV['RACK_ENV']}.sqlite3",
  :recent_urls      => 25,
  :tweet            => "Check this out: %short_url%",
  :hyves_title      => "Check this out",
  :hyves_body       => "Check this out: %short_url%"
}

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Config

Returns a new instance of Config.



15
16
17
18
# File 'lib/tmin/config.rb', line 15

def initialize obj
  self.update DEFAULTS
  self.update obj
end

Instance Method Details

#set(key, val = nil, &blk) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/tmin/config.rb', line 20

def set key, val = nil, &blk
  if val.is_a? Hash
    self[key].update val
  else
    self[key] = block_given?? blk : val
  end
end