Class: Deferral::StackFrame
- Inherits:
-
Object
- Object
- Deferral::StackFrame
- Defined in:
- lib/deferral/stack_frame.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #add(release) ⇒ Object
-
#initialize(type) ⇒ StackFrame
constructor
A new instance of StackFrame.
- #release! ⇒ Object
- #root? ⇒ Boolean
Constructor Details
#initialize(type) ⇒ StackFrame
Returns a new instance of StackFrame.
7 8 9 10 |
# File 'lib/deferral/stack_frame.rb', line 7 def initialize(type) @type = type @releases = [] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/deferral/stack_frame.rb', line 5 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/deferral/stack_frame.rb', line 5 def type @type end |
Instance Method Details
#add(release) ⇒ Object
16 17 18 |
# File 'lib/deferral/stack_frame.rb', line 16 def add(release) @releases << Deferred.new(release) end |
#release! ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/deferral/stack_frame.rb', line 20 def release! return if @releases.empty? @releases.reverse.each do |d| d.call end nil end |
#root? ⇒ Boolean
12 13 14 |
# File 'lib/deferral/stack_frame.rb', line 12 def root? @type == :root end |