123456789_123456789_123456789_123456789_123456789_

Class: Capybara::Server::Middleware::Counter Private

Relationships & Source Files
Inherits: Object
Defined in: lib/capybara/server/middleware.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newCounter

[ GitHub ]

  
# File 'lib/capybara/server/middleware.rb', line 7

def initialize
  @value = []
  @mutex = Mutex.new
end

Instance Attribute Details

#positive?Boolean (readonly)

[ GitHub ]

  
# 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