Class: AWS::Flow::Core::BeginRescueEnsureWrapper Private

Inherits:
FlowFiber
  • Object
show all
Defined in:
lib/aws/flow/begin_rescue_ensure.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Ensures that BeginRescueEnsure isn’t exposed directly. This function is passed in when #error_handler is called, like this:

error_handler do |t|
  t.begin { "This is the begin" }
  t.rescue(Exception) { "This is the rescue" }
  t.ensure { trace << t.begin_task }
end

In this example, t is a BeginRescueEnsureWrapper which passes the begin/rescue/ensure calls to the BeginRescueEnsure class itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FlowFiber

#[], [], []=, #[]=, finalize, unset

Constructor Details

#initialize(block, begin_rescue_ensure) ⇒ BeginRescueEnsureWrapper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new ‘BeginRescueEnsureWrapper` instance.

Parameters:



332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 332

def initialize(block, begin_rescue_ensure)
  @beginRescueEnsure = begin_rescue_ensure
  @__context__ = @beginRescueEnsure
  super() do
    begin
      block.call(self)
    ensure
      @__context__.parent.remove(self)
    end

  end
end

Instance Attribute Details

#__context__Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Also has a few methods to ensure fiber-ness, such as get_heirs and cancel.



321
322
323
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 321

def __context__
  @__context__
end

Instance Method Details

#begin(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Binds the block to a lambda to be called when we get to the begin part of the data flow analysis.

Parameters:

  • block

    The code block to be called when asynchronous begin starts.



368
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 368

def begin(&block) @beginRescueEnsure.begin(block) end

#cancel(error_type) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



352
353
354
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 352

def cancel(error_type)
  @beginRescueEnsure.parent.cancel(self)
end

#ensure(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Binds the block to a lambda to be called when we get to the ensure part of the data flow analysis.

Parameters:

  • block

    The code block to be called when asynchronous ensure starts.



371
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 371

def ensure(&block) @beginRescueEnsure.ensure(block) end

#get_closest_containing_scopeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Gets the parent of the AWS::Flow::Core::BeginRescueEnsure instance held by this class.



363
364
365
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 363

def get_closest_containing_scope
  @beginRescueEnsure.parent
end

#get_heirsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



346
347
348
349
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 346

def get_heirs
  p "I am a BREWrapper"
  return
end

#is_daemon?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


357
358
359
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 357

def is_daemon?
  false
end

#rescue(*error_types, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Binds the block to a lambda to be called when we get to the rescue part of the DFA

Parameters:

  • error_types

    The error types.

  • block

    The code block to be called when asynchronous rescue starts.



374
375
376
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 374

def rescue(*error_types, &block)
  @beginRescueEnsure.rescue(error_types, block)
end