Sha256: ced9da5c4a4b728b9d99d2236e70a6c6083b302b724c7f7f4bb75b224f67a983

Contents?: true

Size: 589 Bytes

Versions: 6

Compression:

Stored size: 589 Bytes

Contents

module Plate
  class DynamicPage < Page    
    attr_accessor :file_path, :locals
    
    def initialize(site, destination_path, meta = {})
      self.site = site
      self.file_path = destination_path
      self.meta = meta      
      self.content = ""
      self.locals = {}
    end
    
    def locals=(hash)
      @locals = hash.symbolize_keys!
    end
    
    def rendered_body
      self.content
    end
    
    # Check to see if a method called is in your locals.
    def method_missing(sym, *args)
      return locals[sym] if locals.has_key?(sym)
      super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
plate-0.6.0 lib/plate/dynamic_page.rb
plate-0.5.4 lib/plate/dynamic_page.rb
plate-0.5.3 lib/plate/dynamic_page.rb
plate-0.5.2 lib/plate/dynamic_page.rb
plate-0.5.1 lib/plate/dynamic_page.rb
plate-0.5.0 lib/plate/dynamic_page.rb