Class: Plate::Dsl::PageProxy

Inherits:
Object
  • Object
show all
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

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

#siteObject



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