Class: AWS::Flow::Core::FlowFiber Private

Inherits:
Fiber
  • Object
show all
Defined in:
lib/aws/flow/fiber.rb

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.

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFlowFiber

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 a new instance of FlowFiber.



24
25
26
27
# File 'lib/aws/flow/fiber.rb', line 24

def initialize(*args)
  ObjectSpace.define_finalizer(self, self.class.finalize(self.object_id))
  super(args)
end

Class Attribute Details

.local_variablesObject

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.



30
31
32
# File 'lib/aws/flow/fiber.rb', line 30

def local_variables
  @local_variables
end

Class Method Details

.[](index) ⇒ 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.



38
39
40
# File 'lib/aws/flow/fiber.rb', line 38

def self.[](index)
  self.local_variables[index]
end

.[]=(key, value) ⇒ 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.



42
43
44
# File 'lib/aws/flow/fiber.rb', line 42

def self.[]=(key, value)
  self.local_variables[key] = value
end

.finalize(obj_id) ⇒ 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.



34
35
36
# File 'lib/aws/flow/fiber.rb', line 34

def self.finalize(obj_id)
  proc { FlowFiber.local_variables.delete(obj_id) }
end

.unset(current_fiber, key) ⇒ 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.

Unsets all the values for ancestors of this fiber, assuming that they have the same value for key. That is, they will unset upwards until the first time the value stored at key is changed.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/aws/flow/fiber.rb', line 50

def self.unset(current_fiber, key)
  current_value = FlowFiber[current_fiber.object_id][key]
  parent = FlowFiber[current_fiber.object_id][:parent]
  ancestor_fibers = []
  while parent != nil
    ancestor_fibers << parent
    parent = FlowFiber[parent.object_id][:parent]
  end
  ancestor_fibers.each do |fiber|
    FlowFiber[fiber.object_id].delete(key) if FlowFiber[fiber.object_id][key] == current_value
  end
  FlowFiber[current_fiber.object_id].delete(key)
end

Instance Method Details

#[](key) ⇒ 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.



75
76
77
# File 'lib/aws/flow/fiber.rb', line 75

def [](key)
  FlowFiber[self.object_id][key]
end

#[]=(key, value) ⇒ 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.



79
80
81
# File 'lib/aws/flow/fiber.rb', line 79

def []=(key, value)
  FlowFiber[self.object_id][key] = value
end