Module: Filet::Hooks

Included in:
Filet
Defined in:
lib/filet/hooks.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



3
4
5
6
7
8
# File 'lib/filet/hooks.rb', line 3

def self.extended(base)
  base.class_eval do
    @@context_hook = nil
    @@feature_hook = nil
  end
end

Instance Method Details

#context_hook(&block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/filet/hooks.rb', line 23

def context_hook(&block)
  if block
    @@context_hook = block
  else
    @@context_hook
  end
end

#context_hook=(block) ⇒ Object



31
32
33
# File 'lib/filet/hooks.rb', line 31

def context_hook=(block)
  @@context_hook = block
end

#feature_hook(&block) ⇒ Object

TODO: Abstract the hook creation if we need another one



11
12
13
14
15
16
17
# File 'lib/filet/hooks.rb', line 11

def feature_hook(&block)
  if block
    @@feature_hook = block
  else
    @@feature_hook
  end
end

#feature_hook=(block) ⇒ Object



19
20
21
# File 'lib/filet/hooks.rb', line 19

def feature_hook=(block)
  @@feature_hook = block
end