Class: Spy::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/spy/core.rb

Instance Method Summary collapse

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_spiesObject



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_collectionObject



7
8
9
# File 'lib/spy/core.rb', line 7

def spy_collection
  @spy_collection ||= Collection.new
end