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



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

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

    #{short_description}
  EOD
end

.regexpObject



13
14
15
# File 'lib/byebug/commands/history.rb', line 13

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

.short_descriptionObject



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

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

Instance Method Details

#executeObject



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

def execute
  history = processor.interface.history

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

  puts history.to_s(size)
end