Class: Byebug::SourceCommand
- Defined in:
- lib/byebug/commands/source.rb
Overview
Execute a file containing byebug commands.
It can be used to restore a previously saved debugging session.
Instance Attribute Summary
Attributes inherited from Command
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
#arguments, columnize, #context, #frame, help, #initialize, match, to_s
Methods included from Helpers::StringHelper
#camelize, #deindent, #prettify
Constructor Details
This class inherits a constructor from Byebug::Command
Class Method Details
.description ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/byebug/commands/source.rb', line 19 def self.description <<-DESCRIPTION source <file> #{short_description} DESCRIPTION end |
.regexp ⇒ Object
15 16 17 |
# File 'lib/byebug/commands/source.rb', line 15 def self.regexp /^\s* so(?:urce)? (?:\s+(\S+))? \s*$/x end |
.short_description ⇒ Object
27 28 29 |
# File 'lib/byebug/commands/source.rb', line 27 def self.short_description "Restores a previously saved byebug session" end |
Instance Method Details
#execute ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/byebug/commands/source.rb', line 31 def execute return puts(help) unless @match[1] file = File.(@match[1]).strip return errmsg(pr("source.errors.not_found", file: file)) unless File.exist?(file) processor.interface.read_file(file) end |