Sha256: d60fc0fa94e37adbd489c65223d2731a9ae534b4e12007450dbf1b353513fca8
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
module Plate # Views are utility classes that are only called within a page or layout file to be able to access # site or page specific variables. class View include BloggingHelper include MetaHelper include URLHelper attr_reader :site, :page def initialize(site, page) @site = site @page = page end # The full list of assets for this site. def assets self.site.assets end # Dump out information about this view. def inspect "#<#{self.class}:0x#{object_id.to_s(16)} site=#{site ? site.source : nil} page=#{page ? page.file : nil}>" end # Reference to all pages and static files in this site. def pages self.site.pages end # Reference to the current post, if this view is rendered with a blog post. def post self.page end # Reference to all posts in this site. def posts self.site.posts end # Allow this class to pass through to access attributes on the page def method_missing(method, *args, &block) self.page.send(method, *args, &block) rescue NoMethodError super end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
plate-0.5.4 | lib/plate/view.rb |
plate-0.5.3 | lib/plate/view.rb |
plate-0.5.2 | lib/plate/view.rb |
plate-0.5.1 | lib/plate/view.rb |
plate-0.5.0 | lib/plate/view.rb |