Class: Mindee::HTTP::CancellationToken

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/http/cancellation_token.rb,
sig/mindee/http/cancellation_token.rbs

Overview

Custom cancellation token class for polling.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCancellationToken

Returns a new instance of CancellationToken.



9
10
11
# File 'lib/mindee/http/cancellation_token.rb', line 9

def initialize
  @is_cancelled = false
end

Instance Attribute Details

#is_canceledBoolean (readonly)

Returns the value of attribute is_canceled.

Returns:

  • (Boolean)


7
8
9
# File 'lib/mindee/http/cancellation_token.rb', line 7

def is_canceled
  @is_canceled
end

Instance Method Details

#cancelvoid

This method returns an undefined value.

Cancel the token.



14
15
16
# File 'lib/mindee/http/cancellation_token.rb', line 14

def cancel
  @is_cancelled = true
end

#canceled?Boolean

Check if the token is canceled.

Returns:

  • (Boolean)


19
20
21
# File 'lib/mindee/http/cancellation_token.rb', line 19

def canceled?
  @is_cancelled
end