class StormyApp
Attributes
cache[R]
defaults[R]
options[R]
page_not_found[R]
root[R]
store[R]
Public Class Methods
new(options)
click to toggle source
# File lib/stormy_app.rb, line 5 def initialize(options) @options = options @root = options[:root] || raise("Missing :root config") @cache = (options[:cache] || Stormy::Caches::DummyCache).new(self) @store = (options[:store] || Stormy::Stores::FileStore).new(self) @page_not_found = (options[:page_not_found] || "/404") @defaults = YAML.load_file(File.join(root, options[:defaults] || 'config.yml')) rescue {} @defaults.symbolize_keys! end
Public Instance Methods
content(category,key)
click to toggle source
# File lib/stormy_app.rb, line 23 def content(category,key) Stormy::Content.fetch(self,category,key) end
content_list(category,options={})
click to toggle source
# File lib/stormy_app.rb, line 27 def content_list(category,options={}) Stormy::ContentList.fetch(self,category,options) end
join(*args)
click to toggle source
# File lib/stormy_app.rb, line 35 def join(*args) sanitized_args = [ self.root ] + args.map { |arg| arg.gsub("..","") } File.join(*sanitized_args) end
layout(path,params={})
click to toggle source
# File lib/stormy_app.rb, line 19 def layout(path,params={}) Stormy::Layout.fetch(self,path,params) end
page(path,params={})
click to toggle source
# File lib/stormy_app.rb, line 15 def page(path,params={}) Stormy::Page.fetch(self,path,params) end
template(key,details)
click to toggle source
# File lib/stormy_app.rb, line 31 def template(key,details) Stormy::Template.new(self,key,details) end