Class: Elevate::HTTP::ActivityIndicator
- Inherits:
-
Object
- Object
- Elevate::HTTP::ActivityIndicator
- Defined in:
- lib/elevate/http/activity_indicator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #hide ⇒ Object
-
#initialize ⇒ ActivityIndicator
constructor
A new instance of ActivityIndicator.
- #show ⇒ Object
Constructor Details
#initialize ⇒ ActivityIndicator
Returns a new instance of ActivityIndicator.
10 11 12 13 |
# File 'lib/elevate/http/activity_indicator.rb', line 10 def initialize @lock = NSLock.alloc.init @count = 0 end |
Class Method Details
.instance ⇒ Object
4 5 6 7 8 |
# File 'lib/elevate/http/activity_indicator.rb', line 4 def self.instance Dispatch.once { @instance = new } @instance end |
Instance Method Details
#hide ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/elevate/http/activity_indicator.rb', line 15 def hide toggled = false @lock.lock @count -= 1 if @count > 0 toggled = @count == 0 @lock.unlock update_indicator(false) if toggled end |
#show ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elevate/http/activity_indicator.rb', line 26 def show toggled = false @lock.lock toggled = @count == 0 @count += 1 @lock.unlock update_indicator(true) if toggled end |