Class: CountingSemaphore::Lease
- Inherits:
-
Struct
- Object
- Struct
- CountingSemaphore::Lease
- Defined in:
- lib/counting_semaphore.rb
Overview
Represents an acquired lease on a semaphore. Must be passed to release() to return the permits.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#permits ⇒ Object
Returns the value of attribute permits.
-
#semaphore ⇒ Object
Returns the value of attribute semaphore.
Instance Method Summary collapse
-
#inspect ⇒ String
Returns detailed inspection string.
-
#to_s ⇒ String
Returns a human-readable representation of the lease.
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
8 9 10 |
# File 'lib/counting_semaphore.rb', line 8 def id @id end |
#permits ⇒ Object
Returns the value of attribute permits
8 9 10 |
# File 'lib/counting_semaphore.rb', line 8 def permits @permits end |
#semaphore ⇒ Object
Returns the value of attribute semaphore
8 9 10 |
# File 'lib/counting_semaphore.rb', line 8 def semaphore @semaphore end |
Instance Method Details
#inspect ⇒ String
Returns detailed inspection string
19 20 21 |
# File 'lib/counting_semaphore.rb', line 19 def inspect "#<CountingSemaphore::Lease permits=#{permits} id=#{id.inspect}>" end |
#to_s ⇒ String
Returns a human-readable representation of the lease
12 13 14 |
# File 'lib/counting_semaphore.rb', line 12 def to_s "Lease(#{permits} permits, id: #{id})" end |