Class: Byebug::HistoryCommand

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

Overview

Show history of byebug commands.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Byebug::Helpers::ParseHelper

#get_int, #parse_steps, #syntax_valid?

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Byebug::Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



19
20
21
22
23
24
25
# File 'lib/byebug/commands/history.rb', line 19

def self.description
  <<-DESCRIPTION
    hist[ory][ num_cmds]

    #{short_description}
  DESCRIPTION
end

.regexpObject



15
16
17
# File 'lib/byebug/commands/history.rb', line 15

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

.short_descriptionObject



27
28
29
# File 'lib/byebug/commands/history.rb', line 27

def self.short_description
  "Shows byebug's history of commands"
end

Instance Method Details

#executeObject



31
32
33
34
35
36
37
# File 'lib/byebug/commands/history.rb', line 31

def execute
  history = processor.interface.history

  size, = get_int(@match[:num_cmds], "history", 1) if @match[:num_cmds]

  puts history.to_s(size)
end