class TL1::Command

A representation of a CLI interaction, including an input message format and an output message format.

Attributes

input_format[R]
output_format[R]

Public Class Methods

new(input, output = nil) click to toggle source
# File lib/tl1/command.rb, line 10
def initialize(input, output = nil)
  @input_format = TL1::InputFormat.new(input)
  @output_format = output && TL1::OutputFormat.new(output)
end

Public Instance Methods

input(**kwargs) click to toggle source
# File lib/tl1/command.rb, line 15
def input(**kwargs)
  input_format.format(**kwargs) + ';'
end
parse_output(output) click to toggle source
# File lib/tl1/command.rb, line 23
def parse_output(output)
  return output unless output_format

  record_sources(output).map do |record_source|
    output_format.parse(record_source)
  end
end
record_sources(output) click to toggle source
# File lib/tl1/command.rb, line 19
def record_sources(output)
  OutputScanner.new(output).records
end