Class: Mindee::HTTP::CancellationToken

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

Overview

Custom cancellation token class for polling.

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 Method Details

#cancelObject

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