Class: Byebug::ScriptInterface
Instance Attribute Summary
Attributes inherited from Interface
#command_queue, #restart_file
Instance Method Summary
collapse
Methods inherited from Interface
#errmsg, #escape, #format
Constructor Details
#initialize(file, out, verbose = false) ⇒ ScriptInterface
Returns a new instance of ScriptInterface.
3
4
5
6
7
|
# File 'lib/byebug/interfaces/script_interface.rb', line 3
def initialize(file, out, verbose=false)
super()
@file = file.respond_to?(:gets) ? file : open(file)
@out, @verbose = out, verbose
end
|
Instance Method Details
#close ⇒ Object
26
27
28
|
# File 'lib/byebug/interfaces/script_interface.rb', line 26
def close
@file.close
end
|
#confirm(prompt) ⇒ Object
18
19
20
|
# File 'lib/byebug/interfaces/script_interface.rb', line 18
def confirm(prompt)
'y'
end
|
#print(*args) ⇒ Object
22
23
24
|
# File 'lib/byebug/interfaces/script_interface.rb', line 22
def print(*args)
@out.printf(*args)
end
|
#read_command(prompt) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/byebug/interfaces/script_interface.rb', line 9
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
|