Sha256: ef00e867f176512a2005f7b8264261068bbcbdeaffbcbd65677b77e3d84dd400
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
class StormyApp attr_reader :root, :cache, :store, :defaults, :options, :page_not_found 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 def page(path,params={}) Stormy::Page.fetch(self,path,params) end def layout(path,params={}) Stormy::Layout.fetch(self,path,params) end def content(category,key) Stormy::Content.fetch(self,category,key) end def content_list(category,options={}) Stormy::ContentList.fetch(self,category,options) end def template(key,details) Stormy::Template.new(self,key,details) end def join(*args) sanitized_args = [ self.root ] + args.map { |arg| arg.gsub("..","") } File.join(*sanitized_args) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stormy-0.0.1 | lib/stormy_app.rb |