Class: FatFreeCRM::Callback::Base
- Inherits:
-
Object
- Object
- FatFreeCRM::Callback::Base
- Includes:
- Singleton
- Defined in:
- lib/fat_free_crm/callback.rb
Overview
Class Attribute Summary collapse
-
.view_hooks ⇒ Object
Returns the value of attribute view_hooks.
Class Method Summary collapse
- .add_view_hook(hook, proc, position) ⇒ Object
- .inherited(child) ⇒ Object
- .insert_after(hook, &block) ⇒ Object
- .insert_before(hook, &block) ⇒ Object
- .remove(hook) ⇒ Object
- .replace(hook, &block) ⇒ Object
Class Attribute Details
.view_hooks ⇒ Object
Returns the value of attribute view_hooks.
78 79 80 |
# File 'lib/fat_free_crm/callback.rb', line 78 def view_hooks @view_hooks end |
Class Method Details
.add_view_hook(hook, proc, position) ⇒ Object
80 81 82 83 |
# File 'lib/fat_free_crm/callback.rb', line 80 def add_view_hook(hook, proc, position) @view_hooks[hook] += [{:proc => proc, :position => position}] end |
.inherited(child) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/fat_free_crm/callback.rb', line 68 def self.inherited(child) FatFreeCRM::Callback.add(child) # Positioning hash to determine where content is placed. child.class_eval do @view_hooks = Hash.new([]) end super end |
.insert_after(hook, &block) ⇒ Object
86 |
# File 'lib/fat_free_crm/callback.rb', line 86 def insert_after(hook, &block); add_view_hook(hook, block, :after); end |
.insert_before(hook, &block) ⇒ Object
85 |
# File 'lib/fat_free_crm/callback.rb', line 85 def insert_before(hook, &block); add_view_hook(hook, block, :before); end |
.remove(hook) ⇒ Object
88 |
# File 'lib/fat_free_crm/callback.rb', line 88 def remove(hook); add_view_hook(hook, Proc.new{""}, :replace); end |
.replace(hook, &block) ⇒ Object
87 |
# File 'lib/fat_free_crm/callback.rb', line 87 def replace(hook, &block); add_view_hook(hook, block, :replace); end |