Sha256: 0748c2b220490197007411c951543c5e4a89e40861f006a1b4ebd2c0648dc79b
Contents?: true
Size: 696 Bytes
Versions: 3
Compression:
Stored size: 696 Bytes
Contents
require_relative 'statement' module Basic101 class NextStatement < Statement def initialize(reference) @reference = reference end def execute(runtime) for_statement = if @reference.nil? runtime.for_stack.top else runtime.for_stack[@reference] end raise NextWithoutFor unless for_statement for_statement.increment(runtime) if for_statement.done?(runtime) for_statement.delete_from_stack(runtime) else for_statement.goto_following_statement(runtime) end end protected def state @reference end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-0.4.0 | lib/basic101/next_statement.rb |
basic101-0.2.0 | lib/basic101/next_statement.rb |
basic101-0.1.0 | lib/basic101/next_statement.rb |