Class: Listen::Compat::Test::Fake

Inherits:
Wrapper::Common show all
Defined in:
lib/listen/compat/test/fake.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Wrapper::Common

#listen

Constructor Details

#initializeFake

Returns a new instance of Fake.



23
24
25
26
27
28
29
30
31
# File 'lib/listen/compat/test/fake.rb', line 23

def initialize
  thread = Thread.current

  thread[:fake_instances] = Queue.new
  thread[:fake_events] = Queue.new
  thread[:fake_processed_events] = Queue.new

  Fake._instances(thread) << self
end

Instance Attribute Details

#directoriesObject (readonly)

Returns the value of attribute directories.



21
22
23
# File 'lib/listen/compat/test/fake.rb', line 21

def directories
  @directories
end

Class Method Details

.collect_instances(thread) ⇒ Object



14
15
16
17
18
19
# File 'lib/listen/compat/test/fake.rb', line 14

def self.collect_instances(thread)
  return [] if _instances(thread).empty?
  result = []
  result << _instances(thread).pop until _instances(thread).empty?
  result
end

.fire_events(thread, *args) ⇒ Object



7
8
9
10
11
12
# File 'lib/listen/compat/test/fake.rb', line 7

def self.fire_events(thread, *args)
  processed = _processed(thread)
  processed.pop until processed.empty?
  _events(thread) << args
  processed.pop
end