Wraps both a `Proc` and an {Example} for use in {Hooks#around around} hooks. In around hooks we need to yield this special kind of object (rather than the raw {Example}) because when there are multiple `around` hooks we have to wrap them recursively.
@example
RSpec.configure do |c| c.around do |ex| # Procsy which wraps the example if ex.metadata[:key] == :some_value && some_global_condition raise "some message" end ex.run # run delegates to ex.call end end
@note This class also exposes the instance methods of {Example},
proxying them through to the wrapped {Example} instance.
The {Example} instance.
# File lib/rspec/core/example.rb, line 212 def initialize(example, &block) @example = example @proc = block end
@private
# File lib/rspec/core/example.rb, line 218 def wrap(&block) self.class.new(example, &block) end