Class: Byebug::ListCommand
- Extended by:
- Forwardable
- Includes:
- Helpers::FileHelper, Helpers::ParseHelper
- Defined in:
- lib/byebug/commands/list.rb
Overview
List parts of the source code.
Instance Attribute Summary
Attributes inherited from Command
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Helpers::ParseHelper
#get_int, #parse_steps, #syntax_valid?
Methods included from Helpers::FileHelper
#get_line, #get_lines, #n_lines, #normalize, #shortpath, #virtual_file?
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
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/byebug/commands/list.rb', line 22 def self.description <<-DESCRIPTION l[ist][[-=]][ nn-mm] #{short_description} Lists lines forward from current line or from the place where code was last listed. If "list-" is specified, lists backwards instead. If "list=" is specified, lists from current line regardless of where code was last listed. A line range can also be specified to list specific sections of code. DESCRIPTION end |
.regexp ⇒ Object
18 19 20 |
# File 'lib/byebug/commands/list.rb', line 18 def self.regexp /^\s* l(?:ist)? (?:\s*([-=])|\s+(\S+))? \s*$/x end |
.short_description ⇒ Object
36 37 38 |
# File 'lib/byebug/commands/list.rb', line 36 def self.short_description "Lists lines of source code" end |
Instance Method Details
#execute ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/byebug/commands/list.rb', line 40 def execute msg = "No sourcefile available for #{frame.file}" raise(msg) unless File.exist?(frame.file) b, e = range(@match[2]) display_lines(b, e) processor.prev_line = b end |