Class: Byebug::ShowCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/show.rb

Overview

Show byebug settings.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/byebug/commands/show.rb', line 27

def description
  <<-EOD.gsub(/^ {8}/, '')

    show <setting> <value>

    Generic command for showing byebug settings. You can change them with
    the "set" command.

  EOD
end

.help(subcmds = []) ⇒ Object



38
39
40
# File 'lib/byebug/commands/show.rb', line 38

def help(subcmds = [])
  Setting.help('show', subcmds.first)
end

.namesObject



23
24
25
# File 'lib/byebug/commands/show.rb', line 23

def names
  %w(show)
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
# File 'lib/byebug/commands/show.rb', line 12

def execute
  key = @match[:setting]
  return puts(self.class.help) if key.nil?

  full_key = Setting.find(key)
  return errmsg("Unknown setting :#{key}") unless full_key

  puts Setting.settings[full_key.to_sym].to_s
end

#regexpObject



8
9
10
# File 'lib/byebug/commands/show.rb', line 8

def regexp
  /^\s* show (?:\s+(?<setting>\w+))? \s*$/x
end