Class: Alexandria::UI::SearchThreadCounter

Inherits:
Monitor
  • Object
show all
Defined in:
lib/alexandria/ui/acquire_dialog.rb

Overview

assists in turning on progress bar when searching and turning it off when all search threads have completed…

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSearchThreadCounter

Returns a new instance of SearchThreadCounter.



23
24
25
26
# File 'lib/alexandria/ui/acquire_dialog.rb', line 23

def initialize
  @count = 0
  super
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



21
22
23
# File 'lib/alexandria/ui/acquire_dialog.rb', line 21

def count
  @count
end

Instance Method Details

#end_searchObject



34
35
36
37
38
# File 'lib/alexandria/ui/acquire_dialog.rb', line 34

def end_search
  synchronize do
    @count -= 1 unless @count.zero?
  end
end

#new_searchObject



28
29
30
31
32
# File 'lib/alexandria/ui/acquire_dialog.rb', line 28

def new_search
  synchronize do
    @count += 1
  end
end