Class: Firefly::Config

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

Constant Summary collapse

DEFAULTS =
{
  :hostname         => "localhost:3000",
  :api_key          => "test",
  :database         => "sqlite3://#{Dir.pwd}/firefly_#{ENV['RACK_ENV']}.sqlite3",
  :recent_urls      => 25,
  :twitter          => "Check this out: %short_url%",
  :hyves_path       => "toevoegen/tips",
  :hyves_args       => "type=12&rating=5",
  :hyves_title      => "Check this out",
  :hyves_body       => "Check this out: %short_url%",
  :qr_size          => "150x150"
}

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Config

Returns a new instance of Config.



18
19
20
21
# File 'lib/firefly/config.rb', line 18

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

Instance Method Details

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



23
24
25
26
27
28
29
# File 'lib/firefly/config.rb', line 23

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