Class: CountingSemaphore::Lease

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id



8
9
10
# File 'lib/counting_semaphore.rb', line 8

def id
  @id
end

#permitsObject

Returns the value of attribute permits



8
9
10
# File 'lib/counting_semaphore.rb', line 8

def permits
  @permits
end

#semaphoreObject

Returns the value of attribute semaphore



8
9
10
# File 'lib/counting_semaphore.rb', line 8

def semaphore
  @semaphore
end

Instance Method Details

#inspectString

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_sString

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