Class: Byebug::HistoryCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def description
  %{hist[ory] [num_cmds]\t\tShow byebug's command history}
end

.namesObject



19
20
21
# File 'lib/byebug/commands/history.rb', line 19

def names
  %w(history)
end

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/byebug/commands/history.rb', line 7

def execute
  if Setting[:autosave]
    if arg = @match[:num_cmds]
      size = get_int(arg, 'history', 1, Setting[:histsize])
    end
    print History.to_s(size || Setting[:histsize])
  else
    errmsg "Not currently saving history. Enable it with \"set autosave\"\n"
  end
end

#regexpObject



3
4
5
# File 'lib/byebug/commands/history.rb', line 3

def regexp
  /^\s* hist(?:ory)? (?:\s+(?<num_cmds>.+))? \s*$/x
end