Class: Byebug::Skipper::SkipBangCommand

Inherits:
Byebug::SkipCommand
  • Object
show all
Defined in:
lib/byebug/skipper/skip_bang_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject



11
12
13
# File 'lib/byebug/skipper/skip_bang_command.rb', line 11

def self.description
  short_description
end

.regexpObject



3
4
5
# File 'lib/byebug/skipper/skip_bang_command.rb', line 3

def self.regexp
  /^ \s* skip! \s* $/x
end

.short_descriptionObject



7
8
9
# File 'lib/byebug/skipper/skip_bang_command.rb', line 7

def self.short_description
  "Same as `skip` but also comments out the line before the current one (where `byebug` or `binding.pry` usually is)"
end

Instance Method Details

#initialize_attributesObject

This method gets run once when the command starts. After that, ‘#execute` gets called repeatedly from different locations, so we can’t use it without adding random commented lines everywhere.



18
19
20
21
# File 'lib/byebug/skipper/skip_bang_command.rb', line 18

def initialize_attributes
  CommentLineAbove.(context.location)
  super
end