Class: Igniter::LedgerClient::Subscription
- Inherits:
-
Object
- Object
- Igniter::LedgerClient::Subscription
- Defined in:
- lib/igniter/ledger_client/subscription.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(&close_proc) ⇒ Subscription
constructor
A new instance of Subscription.
Constructor Details
#initialize(&close_proc) ⇒ Subscription
Returns a new instance of Subscription.
8 9 10 11 12 |
# File 'lib/igniter/ledger_client/subscription.rb', line 8 def initialize(&close_proc) @close_proc = close_proc @closed = false @mutex = Mutex.new end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
6 7 8 |
# File 'lib/igniter/ledger_client/subscription.rb', line 6 def error @error end |
Instance Method Details
#close ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/igniter/ledger_client/subscription.rb', line 14 def close close_proc = nil @mutex.synchronize do return self if @closed @closed = true close_proc = @close_proc end close_proc&.call self end |
#closed? ⇒ Boolean
27 28 29 |
# File 'lib/igniter/ledger_client/subscription.rb', line 27 def closed? @mutex.synchronize { @closed } end |