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 Method Summary collapse
Methods inherited from Command
#help, #initialize, #match, subcommands, to_name
Methods included from Helpers::StringHelper
Constructor Details
This class inherits a constructor from Byebug::Command
Instance Method Details
#description ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/byebug/commands/source.rb', line 31 def description <<-EOD source <file> Executes file <file> containing byebug commands. EOD end |
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/byebug/commands/source.rb', line 16 def execute return puts(help) unless @match[1] unless @state && @state.interface return errmsg(pr('source.errors.not_available')) end file = File.(@match[1]).strip unless File.exist?(file) return errmsg(pr('source.errors.not_found', file: file)) end @state.interface.read_file(file) end |
#regexp ⇒ Object
12 13 14 |
# File 'lib/byebug/commands/source.rb', line 12 def regexp /^\s* so(?:urce)? (?:\s+(\S+))? \s*$/x end |