Class: Byebug::ScriptInterface
Overview
Interface class for command execution from script files.
Instance Attribute Summary
Attributes inherited from Interface
#command_queue, #restart_file
Instance Method Summary
collapse
Methods inherited from Interface
#errmsg
Constructor Details
#initialize(file, out, verbose = false) ⇒ ScriptInterface
Returns a new instance of ScriptInterface.
6
7
8
9
10
|
# File 'lib/byebug/interfaces/script_interface.rb', line 6
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
29
30
31
|
# File 'lib/byebug/interfaces/script_interface.rb', line 29
def close
@file.close
end
|
#confirm(_prompt) ⇒ Object
21
22
23
|
# File 'lib/byebug/interfaces/script_interface.rb', line 21
def confirm(_prompt)
'y'
end
|
#puts(message) ⇒ Object
25
26
27
|
# File 'lib/byebug/interfaces/script_interface.rb', line 25
def puts(message)
@out.printf(message)
end
|
#read_command(_prompt) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/byebug/interfaces/script_interface.rb', line 12
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
|