Class: Capybara::Server::Middleware::Counter Private
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/capybara/server/middleware.rb |
Class Method Summary
- .new ⇒ Counter constructor Internal use only
Instance Attribute Summary
- #positive? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #decrement(uri) Internal use only
- #increment(uri) Internal use only
- #value Internal use only
Constructor Details
.new ⇒ Counter
# File 'lib/capybara/server/middleware.rb', line 7
def initialize @value = [] @mutex = Mutex.new end
Instance Attribute Details
#positive? ⇒ Boolean
(readonly)
# File 'lib/capybara/server/middleware.rb', line 20
def positive? @mutex.synchronize { @value.length.positive? } end
Instance Method Details
#decrement(uri)
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 16
def decrement(uri) @mutex.synchronize { @value.delete_at(@value.index(uri) || - 1) } end
#increment(uri)
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 12
def increment(uri) @mutex.synchronize { @value.push(uri) } end
#value
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 24
def value @mutex.synchronize { @value.dup } end