Top Level Namespace

Defined Under Namespace

Modules: Nukumber Classes: String

Instance Method Summary collapse

Instance Method Details

#After(*tags, &proc) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nukumber/hooks.rb', line 13

def After(*tags, &proc)
  unless tags.empty?
    tags.first.split(',').each do |t|
      $after_hooks[t.strip.to_sym] ||= []
      $after_hooks[t.strip.to_sym] << proc
    end
    return
  end
  $after_hooks[:each] ||= []
  $after_hooks[:each] << proc
end

#Before(*tags, &proc) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
# File 'lib/nukumber/hooks.rb', line 1

def Before(*tags, &proc)
  unless tags.empty?
    tags.first.split(',').each do |t|
      $before_hooks[t.strip.to_sym] ||= []
      $before_hooks[t.strip.to_sym] << proc
    end
    return
  end
  $before_hooks[:each] ||= []
  $before_hooks[:each] << proc
end