Class: CodeBackbonePointsInstruction
Instance Attribute Summary
Attributes inherited from Instruction
#context
Instance Method Summary
collapse
Methods inherited from Instruction
all_instructions, #go, inherited, #initialize, #needs, #pushes, to_nudgecode
Constructor Details
This class inherits a constructor from Instruction
Instance Method Details
#cleanup ⇒ Object
21
22
23
|
# File 'lib/instructions/code/code_backbone_points.rb', line 21
def cleanup
pushes :int, @result
end
|
#derive ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/instructions/code/code_backbone_points.rb', line 12
def derive
if @parsed.parses?
pts = @parsed.linked_code.kind_of?(CodeblockPoint) ? @parsed[1].contents.length : 0
else
pts = 0
end
@result = ValuePoint.new("int",pts)
end
|
#preconditions? ⇒ Boolean
3
4
5
|
# File 'lib/instructions/code/code_backbone_points.rb', line 3
def preconditions?
needs :code, 1
end
|
#setup ⇒ Object
7
8
9
10
|
# File 'lib/instructions/code/code_backbone_points.rb', line 7
def setup
arg_blueprint = @context.pop_value(:code)
@parsed = NudgeProgram.new(arg_blueprint)
end
|