Class: Debugger::ScriptInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-debug/interface.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(file, out) ⇒ ScriptInterface

Returns a new instance of ScriptInterface.



91
92
93
94
# File 'lib/ruby-debug/interface.rb', line 91

def initialize(file, out)
  @file = file.respond_to?(:gets) ? file : open(file)
  @out = out
end

Instance Method Details

#closeObject



114
115
116
# File 'lib/ruby-debug/interface.rb', line 114

def close
  @file.close
end

#confirm(prompt) ⇒ Object



106
107
108
# File 'lib/ruby-debug/interface.rb', line 106

def confirm(prompt)
  'y'
end


110
111
112
# File 'lib/ruby-debug/interface.rb', line 110

def print(*args)
  @out.print(*args)
end

#read_command(prompt) ⇒ Object

Raises:

  • (IOError)


96
97
98
99
100
101
102
103
104
# File 'lib/ruby-debug/interface.rb', line 96

def read_command(prompt)
  while result = @file.gets
    next if result =~ /^\s*#/
    next if result.strip.empty?
    break
  end
  raise IOError unless result
  result
end