Class: RSpec::Core::Hooks::HookCollection

Inherits:
Array
  • Object
show all
Includes:
HookCollectionAliases
Defined in:
lib/rspec/core/hooks.rb

Instance Method Summary collapse

Instance Method Details

#for(example_or_group) ⇒ Object



61
62
63
64
# File 'lib/rspec/core/hooks.rb', line 61

def for(example_or_group)
  self.class.new(select {|hook| hook.options_apply?(example_or_group)}).
    with(example_or_group)
end

#runObject



71
72
73
# File 'lib/rspec/core/hooks.rb', line 71

def run
  each {|h| h.run(@example) } unless empty?
end

#with(example) ⇒ Object



66
67
68
69
# File 'lib/rspec/core/hooks.rb', line 66

def with(example)
  @example = example
  self
end