Class: Spy::Core
- Inherits:
-
Object
- Object
- Spy::Core
- Defined in:
- lib/spy/core.rb
Instance Method Summary collapse
Instance Method Details
#add_spy(spied, method) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/spy/core.rb', line 7 def add_spy(spied, method) if collection.include?(spied, method) raise Errors::AlreadySpiedError end spy = Instance.new(spied, method) collection.insert(spied, method, spy) spy.start end |
#remove_all_spies ⇒ Object
21 22 23 |
# File 'lib/spy/core.rb', line 21 def remove_all_spies collection.remove_all { |spy| spy.stop } end |
#remove_spy(spied, method) ⇒ Object
16 17 18 19 |
# File 'lib/spy/core.rb', line 16 def remove_spy(spied, method) spy = collection.remove(spied, method) spy.stop end |