Class: Toto::Config
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", # root URL of the site :prefix => "", # common path prefix for the blog :permalink => ":year/:month/:day/:title", # permalink prefix format :date => lambda {|now| now.strftime("%d/%m/%Y") }, # date function :markdown => :smart, # use markdown :disqus => false, # disqus name :summary => {:max => 150, :delim => /~\n/}, # length of summary and delimiter :ext => 'txt', # extension for articles :cache => 28800, # cache duration (seconds) :github => {:user => "", :repos => [], :ext => 'md'}, # Github username and list of repos :to_html => lambda {|path, page, ctx| # returns an html, from a path & context ERB.new(File.read("#{path}/#{page}.rhtml")).result(ctx) }, :error => lambda {|code| # The HTML for your error page "<font style='font-size:300%'>toto, we're not in Kansas anymore (#{code})</font>" } }
Instance Method Summary collapse
-
#initialize(obj) ⇒ Config
constructor
A new instance of Config.
- #set(key, val = nil, &blk) ⇒ Object
Constructor Details
Instance Method Details
#set(key, val = nil, &blk) ⇒ Object
333 334 335 336 337 338 339 |
# File 'lib/toto.rb', line 333 def set key, val = nil, &blk if val.is_a? Hash self[key].update val else self[key] = block_given?? blk : val end end |