Class: SemiStatic::Backend
Instance Attribute Summary
Attributes inherited from Page
Instance Method Summary collapse
- #all(page_type) ⇒ Object
-
#initialize(root) ⇒ Backend
constructor
A new instance of Backend.
Methods inherited from Page
all, find, first, #persisted?, #render, #to_param, #to_s
Constructor Details
Instance Method Details
#all(page_type) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/semi_static/backend.rb', line 9 def all(page_type) if !@cache.key?(page_type) || !Rails.application.config.cache_classes path = File.join(@root,ActiveModel::Naming.plural(page_type), "*") @cache[page_type] = Dir.glob(path).map do |f| yaml, body = File.read(f).split("\n...\n", 2) h = YAML.load(yaml) page_type.new(SemiStatic::TiltWrapper.template(f,body), h) end end @cache[page_type] end |