Class: Spy::Core
- Inherits:
-
Object
- Object
- Spy::Core
- Defined in:
- lib/spy/core.rb
Instance Method Summary collapse
- #add_spy(spied, method) ⇒ Object
- #remove_all_spies ⇒ Object
- #remove_spy(spied, method) ⇒ Object
- #spy_collection ⇒ Object
Instance Method Details
#add_spy(spied, method) ⇒ Object
11 12 13 14 15 |
# File 'lib/spy/core.rb', line 11 def add_spy(spied, method) spy = Instance.new(spied, method) spy_collection << spy spy.start end |
#remove_all_spies ⇒ Object
22 23 24 |
# File 'lib/spy/core.rb', line 22 def remove_all_spies spy_collection.remove_all { |spy| spy.stop } end |
#remove_spy(spied, method) ⇒ Object
17 18 19 20 |
# File 'lib/spy/core.rb', line 17 def remove_spy(spied, method) spy = spy_collection.pop(method) spy.stop end |
#spy_collection ⇒ Object
7 8 9 |
# File 'lib/spy/core.rb', line 7 def spy_collection @spy_collection ||= Collection.new end |