Class: Spy::Strategy::Wrap
- Inherits:
-
Object
- Object
- Spy::Strategy::Wrap
- Defined in:
- lib/spy/strategy/wrap.rb
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(spy) ⇒ Wrap
constructor
A new instance of Wrap.
- #undo ⇒ Object
Constructor Details
#initialize(spy) ⇒ Wrap
Returns a new instance of Wrap.
6 7 8 |
# File 'lib/spy/strategy/wrap.rb', line 6 def initialize(spy) @spy = spy end |
Instance Method Details
#apply ⇒ Object
10 11 12 |
# File 'lib/spy/strategy/wrap.rb', line 10 def apply ReplaceMethod.call(@spy.original.owner, @spy, mode: :stub) end |
#undo ⇒ Object
14 15 16 |
# File 'lib/spy/strategy/wrap.rb', line 14 def undo ReplaceMethod.call(@spy.original.owner, @spy, mode: :restore) end |