Module: Filet::Hooks

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



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

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

Instance Method Details

#context_hook(&block) ⇒ Object



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

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

#context_hook=(block) ⇒ Object



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

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

#feature_hook(&block) ⇒ Object

TODO: Abstract the hook creation if we need another one



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

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

#feature_hook=(block) ⇒ Object



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

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