Class: Debugger::ScriptInterface
- Inherits:
-
Object
- Object
- Debugger::ScriptInterface
- Defined in:
- lib/ruby-debug/interface.rb
Overview
:nodoc:
Instance Method Summary collapse
- #close ⇒ Object
- #confirm(prompt) ⇒ Object
-
#initialize(file, out) ⇒ ScriptInterface
constructor
A new instance of ScriptInterface.
- #print(*args) ⇒ Object
- #read_command(prompt) ⇒ Object
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
#close ⇒ Object
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 |
#print(*args) ⇒ Object
110 111 112 |
# File 'lib/ruby-debug/interface.rb', line 110 def print(*args) @out.print(*args) end |
#read_command(prompt) ⇒ Object
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 |