Class: Jekyll::Document
- Inherits:
-
Object
- Object
- Jekyll::Document
- Defined in:
- lib/octopress-hooks.rb
Overview
Monkey patch Jekyll’s Document class
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(*args) ⇒ Document
constructor
A new instance of Document.
- #merge_payload(payload) ⇒ Object
- #old_initialize ⇒ Object
- #old_write ⇒ Object
- #post_init ⇒ Object
- #post_render ⇒ Object
- #post_write ⇒ Object
- #pre_render ⇒ Object
- #write(dest) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Document
Returns a new instance of Document.
250 251 252 253 |
# File 'lib/octopress-hooks.rb', line 250 def initialize(*args) old_initialize(*args) post_init if place_in_layout? end |
Instance Method Details
#hooks ⇒ Object
261 262 263 |
# File 'lib/octopress-hooks.rb', line 261 def hooks @hooks ||= site.all_hooks + site.doc_hooks end |
#merge_payload(payload) ⇒ Object
277 278 279 280 281 282 283 284 |
# File 'lib/octopress-hooks.rb', line 277 def merge_payload(payload) hooks.each do |hook| p = hook.merge_payload(payload, self) next unless p && p.is_a?(Hash) payload = hook.deep_merge_payload(payload, p) end payload end |
#old_initialize ⇒ Object
247 |
# File 'lib/octopress-hooks.rb', line 247 alias_method :old_initialize, :initialize |
#old_write ⇒ Object
248 |
# File 'lib/octopress-hooks.rb', line 248 alias_method :old_write, :write |
#post_init ⇒ Object
265 266 267 268 269 |
# File 'lib/octopress-hooks.rb', line 265 def post_init hooks.each do |hook| hook.post_init(self) end end |
#post_render ⇒ Object
286 287 288 289 290 |
# File 'lib/octopress-hooks.rb', line 286 def post_render hooks.each do |hook| hook.post_render(self) end end |
#post_write ⇒ Object
292 293 294 295 296 |
# File 'lib/octopress-hooks.rb', line 292 def post_write hooks.each do |hook| hook.post_write(self) end end |
#pre_render ⇒ Object
271 272 273 274 275 |
# File 'lib/octopress-hooks.rb', line 271 def pre_render hooks.each do |hook| hook.pre_render(self) end end |
#write(dest) ⇒ Object
255 256 257 258 259 |
# File 'lib/octopress-hooks.rb', line 255 def write(dest) post_render if place_in_layout? old_write(dest) post_write if place_in_layout? end |