Class: Eymiha::ForwardReference
- Inherits:
-
Object
- Object
- Eymiha::ForwardReference
- Defined in:
- lib/eymiha/util/forward_referencing.rb
Overview
A ForwardReference holds a continuation and a dependency, the where and the why of forward referencing.
Instance Attribute Summary collapse
-
#context ⇒ Object
Holds an arbitrary object that holds context that can be re-established to help resolve the forward reference.
-
#continuation ⇒ Object
readonly
Holds the place to jump back to for attempting to resolve a forward reference.
-
#dependency ⇒ Object
Holds an arbitrary object that indicates why the forward reference occurred.
Instance Method Summary collapse
-
#initialize(dependency = nil, context = nil) ⇒ ForwardReference
constructor
Returns a new instance with a valid continuation, the given dependency and contextual information.
-
#to_s ⇒ Object
Returns a string indicating the current state of the ForwardReference.
Constructor Details
#initialize(dependency = nil, context = nil) ⇒ ForwardReference
Returns a new instance with a valid continuation, the given dependency and contextual information.
147 148 149 150 151 152 |
# File 'lib/eymiha/util/forward_referencing.rb', line 147 def initialize(dependency=nil,context=nil) @continuation = nil @continuation = callcc{|cont| cont} while (@continuation == nil) @dependency = dependency @context = context end |
Instance Attribute Details
#context ⇒ Object
Holds an arbitrary object that holds context that can be re-established to help resolve the forward reference.
143 144 145 |
# File 'lib/eymiha/util/forward_referencing.rb', line 143 def context @context end |
#continuation ⇒ Object (readonly)
Holds the place to jump back to for attempting to resolve a forward reference.
135 136 137 |
# File 'lib/eymiha/util/forward_referencing.rb', line 135 def continuation @continuation end |
#dependency ⇒ Object
Holds an arbitrary object that indicates why the forward reference occurred.
139 140 141 |
# File 'lib/eymiha/util/forward_referencing.rb', line 139 def dependency @dependency end |
Instance Method Details
#to_s ⇒ Object
Returns a string indicating the current state of the ForwardReference.
155 156 157 |
# File 'lib/eymiha/util/forward_referencing.rb', line 155 def to_s "#{class_name} dependency #{dependency} #{continuation}" end |