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, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def description
  prettify <<-EOD
    show <setting> <value>

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

.help(subcmd = nil) ⇒ Object



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

def help(subcmd = nil)
  Setting.help('show', subcmd)
end

.namesObject



25
26
27
# File 'lib/byebug/commands/show.rb', line 25

def names
  %w(show)
end

Instance Method Details

#executeObject



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

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

  setting = Setting.find(key)
  return errmsg(pr('show.errors.unknown_setting', key: key)) unless setting

  puts Setting.settings[setting.to_sym]
end

#regexpObject



10
11
12
# File 'lib/byebug/commands/show.rb', line 10

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