Class: Persistent::Shell::History

Inherits:
Object
  • Object
show all
Defined in:
lib/persistent-shell-history/history.rb

Overview

Abstract storage for command history

Direct Known Subclasses

BashHistory

Instance Method Summary collapse

Constructor Details

#initializeHistory

Returns a new instance of History.



9
10
11
# File 'lib/persistent-shell-history/history.rb', line 9

def initialize()
  @cmds = Array.new
end

Instance Method Details

#<<(arg) ⇒ Object



14
# File 'lib/persistent-shell-history/history.rb', line 14

def <<(arg); @cmds << arg; end

#commandsObject



12
# File 'lib/persistent-shell-history/history.rb', line 12

def commands; @cmds; end

#commands=(cmds) ⇒ Object



13
# File 'lib/persistent-shell-history/history.rb', line 13

def commands=(cmds); @cmds = cmds; end

#to_aObject



15
# File 'lib/persistent-shell-history/history.rb', line 15

def to_a; commands.map {|c| c.to_h }; end

#to_json(*a) ⇒ Object



16
# File 'lib/persistent-shell-history/history.rb', line 16

def to_json(*a); commands.to_json(*a); end