Class: FatFreeCRM::Callback::Base

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/fat_free_crm/callback.rb

Overview


Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.view_hooksObject

Returns the value of attribute view_hooks.



90
91
92
# File 'lib/fat_free_crm/callback.rb', line 90

def view_hooks
  @view_hooks
end

Class Method Details

.add_view_hook(hook, proc, position) ⇒ Object



92
93
94
95
# File 'lib/fat_free_crm/callback.rb', line 92

def add_view_hook(hook, proc, position)
  @view_hooks[hook] += [{:proc => proc,
                         :position => position}]
end

.inherited(child) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/fat_free_crm/callback.rb', line 80

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



98
# File 'lib/fat_free_crm/callback.rb', line 98

def insert_after(hook, &block);  add_view_hook(hook, block,        :after);   end

.insert_before(hook, &block) ⇒ Object



97
# File 'lib/fat_free_crm/callback.rb', line 97

def insert_before(hook, &block); add_view_hook(hook, block,        :before);  end

.remove(hook) ⇒ Object



100
# File 'lib/fat_free_crm/callback.rb', line 100

def remove(hook);                add_view_hook(hook, Proc.new{""}, :replace); end

.replace(hook, &block) ⇒ Object



99
# File 'lib/fat_free_crm/callback.rb', line 99

def replace(hook, &block);       add_view_hook(hook, block,        :replace); end