Class: Execution
- Inherits:
-
Object
- Object
- Execution
- Defined in:
- lib/Execution.rb
Overview
A shadow execution.
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#caller_class ⇒ Object
Returns the value of attribute caller_class.
-
#caller_id ⇒ Object
Returns the value of attribute caller_id.
-
#caller_object ⇒ Object
Returns the value of attribute caller_object.
-
#child ⇒ Object
Returns the value of attribute child.
-
#control ⇒ Object
Returns the value of attribute control.
-
#is_base ⇒ Object
Returns the value of attribute is_base.
-
#is_reflecting ⇒ Object
Returns the value of attribute is_reflecting.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#method ⇒ Object
Returns the value of attribute method.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#reflections ⇒ Object
Returns the value of attribute reflections.
-
#unique_id ⇒ Object
Returns the value of attribute unique_id.
Instance Method Summary collapse
- #has_empty_reflections? ⇒ Boolean
- #has_finished_reflecting? ⇒ Boolean
-
#initialize(caller_object, method, reflect_amount, stack) ⇒ Execution
constructor
Create Execution.
-
#is_reflecting? ⇒ Boolean
Is the Execution currently reflecting methods?.
Constructor Details
#initialize(caller_object, method, reflect_amount, stack) ⇒ Execution
Create Execution.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/Execution.rb', line 34 def initialize(caller_object, method, reflect_amount, stack) @time = Time.now.to_i @unique_id = @time + rand(1..99999) @base = nil @parent = nil @child = nil # Dependency. @stack = stack # Caller. @caller_object = caller_object @caller_id = caller_object.object_id @caller_class = caller_object.class @klass = @caller_class.to_s.to_sym @method = method # Reflections. @control = nil @reflections = Array.new(reflect_amount) # State. if @stack.peek() == nil @is_base = true else @is_base = false @base = @stack.base() end @is_reflecting = false end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
18 19 20 |
# File 'lib/Execution.rb', line 18 def base @base end |
#caller_class ⇒ Object
Returns the value of attribute caller_class.
15 16 17 |
# File 'lib/Execution.rb', line 15 def caller_class @caller_class end |
#caller_id ⇒ Object
Returns the value of attribute caller_id.
14 15 16 |
# File 'lib/Execution.rb', line 14 def caller_id @caller_id end |
#caller_object ⇒ Object
Returns the value of attribute caller_object.
13 14 15 |
# File 'lib/Execution.rb', line 13 def caller_object @caller_object end |
#child ⇒ Object
Returns the value of attribute child.
20 21 22 |
# File 'lib/Execution.rb', line 20 def child @child end |
#control ⇒ Object
Returns the value of attribute control.
21 22 23 |
# File 'lib/Execution.rb', line 21 def control @control end |
#is_base ⇒ Object
Returns the value of attribute is_base.
24 25 26 |
# File 'lib/Execution.rb', line 24 def is_base @is_base end |
#is_reflecting ⇒ Object
Returns the value of attribute is_reflecting.
23 24 25 |
# File 'lib/Execution.rb', line 23 def is_reflecting @is_reflecting end |
#klass ⇒ Object
Returns the value of attribute klass.
16 17 18 |
# File 'lib/Execution.rb', line 16 def klass @klass end |
#method ⇒ Object
Returns the value of attribute method.
17 18 19 |
# File 'lib/Execution.rb', line 17 def method @method end |
#parent ⇒ Object
Returns the value of attribute parent.
19 20 21 |
# File 'lib/Execution.rb', line 19 def parent @parent end |
#reflections ⇒ Object
Returns the value of attribute reflections.
22 23 24 |
# File 'lib/Execution.rb', line 22 def reflections @reflections end |
#unique_id ⇒ Object
Returns the value of attribute unique_id.
12 13 14 |
# File 'lib/Execution.rb', line 12 def unique_id @unique_id end |
Instance Method Details
#has_empty_reflections? ⇒ Boolean
67 68 69 |
# File 'lib/Execution.rb', line 67 def has_empty_reflections? @reflections.include? nil end |
#has_finished_reflecting? ⇒ Boolean
78 79 80 81 82 83 84 85 86 |
# File 'lib/Execution.rb', line 78 def has_finished_reflecting? if is_reflecting? return false end if has_empty_reflections? return false end return true end |
#is_reflecting? ⇒ Boolean
Is the Execution currently reflecting methods?
74 75 76 |
# File 'lib/Execution.rb', line 74 def is_reflecting? @is_reflecting end |