Class: Debugger::ScriptCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/script.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



22
23
24
25
26
# File 'lib/ruby-debug/commands/script.rb', line 22

def help(cmd)
  %{
    script FILE\texecutes a script file
  }
end

.help_commandObject



18
19
20
# File 'lib/ruby-debug/commands/script.rb', line 18

def help_command
  'script'
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
# File 'lib/ruby-debug/commands/script.rb', line 9

def execute
  unless File.exists?(@match[1])
    print "Script file '#{@match[1]}' is not found\n"
    return
  end
  Debugger.run_script(@match[1], @state)
end

#regexpObject



5
6
7
# File 'lib/ruby-debug/commands/script.rb', line 5

def regexp
  /^\s*sc(?:ript)?\s+(.+)$/
end