Class: Toto::Config

Inherits:
Hash show all
Defined in:
lib/toto.rb

Constant Summary collapse

Defaults =
{
  :author => ENV['USER'],                             # blog author
  :title => Dir.pwd.split('/').last,                  # site title
  :root => "index",                                   # site index
  :url => "http://127.0.0.1",
  :date => lambda {|now| now.strftime("%d/%m/%Y") },  # date function
  :markdown => :smart,                                # use markdown
  :disqus => false,                                   # disqus name
  :summary => 150,                                    # length of summary
  :ext => 'txt'                                       # extension for articles
}

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Config

extension for articles



235
236
237
238
# File 'lib/toto.rb', line 235

def initialize obj
  self.update Defaults
  self.update obj
end

Instance Method Details

#[](key, *args) ⇒ Object



242
243
244
245
# File 'lib/toto.rb', line 242

def [] key, *args
  val = super(key)
  val.respond_to?(:call) ? val.call(*args) : val
end