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.



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