Sha256: 8d5ba9645d80d51edc1aeaf0256f8feec0a9f686acd466c5a842ee0240378677

Contents?: true

Size: 611 Bytes

Versions: 9

Compression:

Stored size: 611 Bytes

Contents

module Byebug
  #
  # Interface class for command execution from script files.
  #
  class ScriptInterface < Interface
    def initialize(file, verbose = false)
      super()
      @verbose = verbose
      @input = File.open(file)
      @output = verbose ? $stdout : StringIO.new
      @error = $stderr
    end

    def read_command(prompt)
      readline(prompt, false)
    end

    def close
      input.close
    end

    def readline(*)
      while (result = input.gets)
        output.puts "+ #{result}" if @verbose
        next if result =~ /^\s*#/
        return result.chomp
      end
    end
  end
end

Version data entries

9 entries across 8 versions & 3 rubygems

Version Path
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0/lib/byebug/interfaces/script_interface.rb
tdiary-5.0.6 vendor/bundle/gems/byebug-9.1.0/lib/byebug/interfaces/script_interface.rb
byebug-9.1.0 lib/byebug/interfaces/script_interface.rb
tdiary-5.0.5 vendor/bundle/gems/byebug-9.0.6/lib/byebug/interfaces/script_interface.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/byebug-9.0.6/lib/byebug/interfaces/script_interface.rb
tdiary-5.0.4 vendor/bundle/gems/byebug-9.0.6/lib/byebug/interfaces/script_interface.rb
byebug-9.0.6 lib/byebug/interfaces/script_interface.rb
byebug-9.0.5 lib/byebug/interfaces/script_interface.rb
byebug-9.0.4 lib/byebug/interfaces/script_interface.rb