Class: Fairy::CFilePlace

Inherits:
Object
  • Object
show all
Defined in:
lib/fairy/share/file-place.rb

Instance Method Summary collapse

Constructor Details

#initialize(vfile) ⇒ CFilePlace

Returns a new instance of CFilePlace.



13
14
15
16
17
18
19
20
# File 'lib/fairy/share/file-place.rb', line 13

def initialize(vfile)
  @vfile = vfile

  # for next_filter
  @no = 0
  @nfileplaces = @vfile.real_file_names
  @nfileplaces_mutex = Mutex.new
end

Instance Method Details

#each_assigned_filter(&block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fairy/share/file-place.rb', line 22

def each_assigned_filter(&block)
  loop do
  fp = nil
  @nfileplaces_mutex.synchronize do
    file = @nfileplaces.shift
    return unless file
    fp = PFilePlace.new(file, @no)
    @no += 1
  end
  block.call fp
  end
end