Class: Alexandria::UI::SearchThreadMonitor

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 Method Summary collapse

Constructor Details

#initializeSearchThreadMonitor

Returns a new instance of SearchThreadMonitor.



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

def initialize
  @count = 0
  super
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/alexandria/ui/acquire_dialog.rb', line 41

def any?
  @count > 0
end

#end_searchObject



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

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

#new_searchObject



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

def new_search
  synchronize do
    @count += 1
  end
end

#none?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/alexandria/ui/acquire_dialog.rb', line 45

def none?
  @count.zero?
end