Class: So::Variable
Instance Method Summary
collapse
Methods inherited from Expr
#!, #<, #==, #>, #[], #to_so_expr
Constructor Details
Returns a new instance of Variable.
81
82
83
84
|
# File 'lib/spec_object.rb', line 81
def initialize
@is_time = false
@is_value = false
end
|
Instance Method Details
#assert_time ⇒ Object
115
116
117
118
|
# File 'lib/spec_object.rb', line 115
def assert_time
@is_time = true
raise "variable used as both value and time" if @is_value
end
|
#assert_value ⇒ Object
110
111
112
113
|
# File 'lib/spec_object.rb', line 110
def assert_value
@is_value = true
raise "variable used as both value and time" if @is_time
end
|
#evaluate(calls) ⇒ Object
106
107
108
|
# File 'lib/spec_object.rb', line 106
def evaluate(calls)
self
end
|
94
95
96
|
# File 'lib/spec_object.rb', line 94
def pp(n)
"#{' '*n}v#{object_id}"
end
|
#substitute(v, e) ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/spec_object.rb', line 98
def substitute(v, e)
if v.object_id == self.object_id
e
else
self
end
end
|
#time? ⇒ Boolean
86
87
88
|
# File 'lib/spec_object.rb', line 86
def time?
@is_time
end
|
#value? ⇒ Boolean
90
91
92
|
# File 'lib/spec_object.rb', line 90
def value?
@is_value
end
|