Class: ParallelTests::Pids

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_tests/pids.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Pids

Returns a new instance of Pids.



8
9
10
11
# File 'lib/parallel_tests/pids.rb', line 8

def initialize(file_path)
  @file_path = file_path
  @mutex = Mutex.new
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



6
7
8
# File 'lib/parallel_tests/pids.rb', line 6

def file_path
  @file_path
end

#mutexObject (readonly)

Returns the value of attribute mutex.



6
7
8
# File 'lib/parallel_tests/pids.rb', line 6

def mutex
  @mutex
end

Instance Method Details

#add(pid) ⇒ Object



13
14
15
16
# File 'lib/parallel_tests/pids.rb', line 13

def add(pid)
  pids << pid.to_i
  save
end

#allObject



28
29
30
31
# File 'lib/parallel_tests/pids.rb', line 28

def all
  read
  pids
end

#countObject



23
24
25
26
# File 'lib/parallel_tests/pids.rb', line 23

def count
  read
  pids.count
end

#delete(pid) ⇒ Object



18
19
20
21
# File 'lib/parallel_tests/pids.rb', line 18

def delete(pid)
  pids.delete(pid.to_i)
  save
end