class CTioga2::Commands::Instruction

This class represents an instruction, i.e. the execution of one Command. It is different in Command in that, for most of them, there will be arguments

Attributes

arguments[RW]

The list of its arguments, already in the correct type.

command[RW]

The Command

options[RW]

The options, already in the correct type

Public Class Methods

new(cmd, args, opts) click to toggle source
# File lib/ctioga2/commands/instruction.rb, line 37
def initialize(cmd, args, opts)
  if not cmd.respond_to?(:run_command)
    c = Interpreter.command(cmd)
    if ! c
      raise "Invalid command #{cmd}"
    end
    cmd = c
  end
  @command = cmd
  @arguments = args
  @options = opts
end

Public Instance Methods

run(plotmaker_target) click to toggle source

Runs this instruction again

# File lib/ctioga2/commands/instruction.rb, line 51
def run(plotmaker_target)
  @command.run_command(plotmaker_target, @arguments, @options)
end
to_s() click to toggle source
# File lib/ctioga2/commands/instruction.rb, line 55
def to_s
  "#{@command.name} #{@arguments.inspect} #{@options.inspect}"
end