Class: Octopress::Partial
- Inherits:
-
Object
- Object
- Octopress::Partial
- Includes:
- Jekyll::Convertible
- Defined in:
- lib/octopress-render-tag/hooks.rb
Overview
Create a new page class to allow partials to trigger Octopress Hooks.
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#data ⇒ Object
Returns the value of attribute data.
-
#ext ⇒ Object
Returns the value of attribute ext.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output ⇒ Object
Returns the value of attribute output.
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(site, name, content) ⇒ Partial
constructor
A new instance of Partial.
- #post_render ⇒ Object
- #pre_render ⇒ Object
- #render(payload) ⇒ Object
Constructor Details
#initialize(site, name, content) ⇒ Partial
Returns a new instance of Partial.
12 13 14 15 16 17 18 19 |
# File 'lib/octopress-render-tag/hooks.rb', line 12 def initialize(site, name, content) @site = site @name = name @ext = File.extname(name) @content = content @data = { layout: nil } # hack end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def content @content end |
#data ⇒ Object
Returns the value of attribute data.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def data @data end |
#ext ⇒ Object
Returns the value of attribute ext.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def ext @ext end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def name @name end |
#output ⇒ Object
Returns the value of attribute output.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def output @output end |
#site ⇒ Object
Returns the value of attribute site.
10 11 12 |
# File 'lib/octopress-render-tag/hooks.rb', line 10 def site @site end |
Instance Method Details
#hooks ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/octopress-render-tag/hooks.rb', line 27 def hooks if self.site.respond_to? :page_hooks self.site.page_hooks else [] end end |
#post_render ⇒ Object
41 42 43 44 45 |
# File 'lib/octopress-render-tag/hooks.rb', line 41 def post_render self.hooks.each do |hook| hook.post_render(self) end end |
#pre_render ⇒ Object
35 36 37 38 39 |
# File 'lib/octopress-render-tag/hooks.rb', line 35 def pre_render self.hooks.each do |hook| hook.pre_render(self) end end |
#render(payload) ⇒ Object
21 22 23 24 25 |
# File 'lib/octopress-render-tag/hooks.rb', line 21 def render(payload) pre_render do_layout(payload, { no_layout: nil }) post_render end |