Sha256: b30cd35f2d8b1f0a0adf0310a89a968bed581a48e8609651242419ca83ef0764

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

module Basic101

  class Transcript

    def self.make(source_path)
      base_path = source_path.chomp('.bas')
      input_file = File.open(base_path + '.input', 'w')
      output_file = File.open(base_path + '.output', 'w')
      new(input_file, output_file)
    end

    def initialize(input_file, output_file)
      @input_file = input_file
      @output_file = output_file
    end

    def save_input(s)
      @input_file.print s
    end

    def save_output(s)
      @output_file.print s
    end

    def save_output_lines(*lines)
      lines.flatten.each do |line|
        save_output "#{line}\n"
      end
    end

    def echo?
      true
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-0.4.0 lib/basic101/transcript.rb
basic101-0.2.0 lib/basic101/transcript.rb
basic101-0.1.0 lib/basic101/transcript.rb