Class: RSpec::Core::Hooks::AroundHookCollection

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

Instance Method Summary collapse

Instance Method Details

#for(example, initial_procsy = nil) ⇒ Object



92
93
94
95
# File 'lib/rspec/core/hooks.rb', line 92

def for(example, initial_procsy=nil)
  self.class.new(select {|hook| hook.options_apply?(example)}).
    with(example, initial_procsy)
end

#runObject



103
104
105
106
107
108
109
# File 'lib/rspec/core/hooks.rb', line 103

def run
  inject(@initial_procsy) do |procsy, around_hook|
    Example.procsy(procsy.) do
      @example.instance_eval_with_args(procsy, &around_hook.block)
    end
  end.call
end

#with(example, initial_procsy) ⇒ Object



97
98
99
100
101
# File 'lib/rspec/core/hooks.rb', line 97

def with(example, initial_procsy)
  @example = example
  @initial_procsy = initial_procsy
  self
end