Class: Plate::Dsl::PageProxy
- Inherits:
-
Object
- Object
- Plate::Dsl::PageProxy
- Defined in:
- lib/plate/dsl.rb
Overview
Used for writing dynamic pages. Allows for calling:
title "Test"
layout "default"
Instead of:
self.title = "Test"
self.layout = "default"
Instance Method Summary collapse
-
#initialize(page, site) ⇒ PageProxy
constructor
A new instance of PageProxy.
- #method_missing(method, *args) ⇒ Object
- #site ⇒ Object
- #to_url(*args) ⇒ Object
Constructor Details
#initialize(page, site) ⇒ PageProxy
Returns a new instance of PageProxy.
40 41 42 43 |
# File 'lib/plate/dsl.rb', line 40 def initialize(page, site) @page = page @site = site end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/plate/dsl.rb', line 61 def method_missing(method, *args) if @page.respond_to?("#{method}=") @page.send("#{method}=", *args) else @page.send(method, *args) end end |
Instance Method Details
#site ⇒ Object
57 58 59 |
# File 'lib/plate/dsl.rb', line 57 def site @site end |
#to_url(*args) ⇒ Object
69 70 71 |
# File 'lib/plate/dsl.rb', line 69 def to_url(*args) @site.to_url(*args) end |