Sha256: 803ddaaa3428c85e63188fe24ccb31420746ec7f07504a74262c05b7950ad7bd

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

module Byebug
  #
  # Interface class for command execution from script files.
  #
  class ScriptInterface < Interface
    def initialize(file, out, verbose = false)
      super()
      @file = file.respond_to?(:gets) ? file : open(file)
      @out, @verbose = out, verbose
    end

    def read_command(_prompt)
      while (result = @file.gets)
        puts "# #{result}" if @verbose
        next if result =~ /^\s*#/
        next if result.strip.empty?
        return result.chomp
      end
    end

    def confirm(_prompt)
      'y'
    end

    def puts(message)
      @out.printf(message)
    end

    def close
      @file.close
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-3.5.1 lib/byebug/interfaces/script_interface.rb
byebug-3.5.0 lib/byebug/interfaces/script_interface.rb
byebug-3.4.2 lib/byebug/interfaces/script_interface.rb
byebug-3.4.1 lib/byebug/interfaces/script_interface.rb
byebug-3.4.0 lib/byebug/interfaces/script_interface.rb
byebug-3.3.0 lib/byebug/interfaces/script_interface.rb