Class: Keisan::AST::Block
- Inherits:
-
Node
- Object
- Node
- Keisan::AST::Block
show all
- Defined in:
- lib/keisan/ast/block.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Node
#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #differentiate, #differentiated, #equal, #evaluate_assignments, #evaluated, #false?, #not_equal, #or, #replaced, #simplified, #to_cell, #to_node, #true?, #well_defined?, #|, #~
Constructor Details
#initialize(child) ⇒ Block
Returns a new instance of Block.
6
7
8
|
# File 'lib/keisan/ast/block.rb', line 6
def initialize(child)
@child = child
end
|
Instance Attribute Details
#child ⇒ Object
Returns the value of attribute child.
4
5
6
|
# File 'lib/keisan/ast/block.rb', line 4
def child
@child
end
|
Instance Method Details
#deep_dup ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/keisan/ast/block.rb', line 24
def deep_dup
dupped = dup
dupped.instance_variable_set(
:@child,
dupped.child.deep_dup
)
dupped
end
|
#evaluate(context = nil) ⇒ Object
38
39
40
41
|
# File 'lib/keisan/ast/block.rb', line 38
def evaluate(context = nil)
local = get_local_context(context)
child.evaluate(local)
end
|
#replace(variable, replacement) ⇒ Object
48
49
50
|
# File 'lib/keisan/ast/block.rb', line 48
def replace(variable, replacement)
self
end
|
#simplify(context = nil) ⇒ Object
43
44
45
46
|
# File 'lib/keisan/ast/block.rb', line 43
def simplify(context = nil)
local = get_local_context(context)
child.simplify(local)
end
|
#to_s ⇒ Object
52
53
54
|
# File 'lib/keisan/ast/block.rb', line 52
def to_s
"{#{child}}"
end
|
#traverse(&block) ⇒ Object
20
21
22
|
# File 'lib/keisan/ast/block.rb', line 20
def traverse(&block)
super(&block) || child.traverse(&block)
end
|
#unbound_functions(context = nil) ⇒ Object
15
16
17
18
|
# File 'lib/keisan/ast/block.rb', line 15
def unbound_functions(context = nil)
local = get_local_context(context)
child.unbound_functions(local)
end
|
#unbound_variables(context = nil) ⇒ Object
10
11
12
13
|
# File 'lib/keisan/ast/block.rb', line 10
def unbound_variables(context = nil)
local = get_local_context(context)
child.unbound_variables(local)
end
|
#value(context = nil) ⇒ Object
33
34
35
36
|
# File 'lib/keisan/ast/block.rb', line 33
def value(context = nil)
local = get_local_context(context)
child.evaluated(local).value(local)
end
|