Class: Capybara::Server::Middleware::Counter
- Inherits:
-
Object
- Object
- Capybara::Server::Middleware::Counter
- Defined in:
- lib/capybara/server.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #decrement ⇒ Object
- #increment ⇒ Object
-
#initialize ⇒ Counter
constructor
A new instance of Counter.
Constructor Details
#initialize ⇒ Counter
Returns a new instance of Counter.
12 13 14 15 |
# File 'lib/capybara/server.rb', line 12 def initialize @value = 0 @mutex = Mutex.new end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/capybara/server.rb', line 10 def value @value end |
Instance Method Details
#decrement ⇒ Object
21 22 23 |
# File 'lib/capybara/server.rb', line 21 def decrement @mutex.synchronize { @value -= 1 } end |
#increment ⇒ Object
17 18 19 |
# File 'lib/capybara/server.rb', line 17 def increment @mutex.synchronize { @value += 1 } end |