Class: Persistent::Shell::History
- Inherits:
-
Object
- Object
- Persistent::Shell::History
- Defined in:
- lib/persistent-shell-history/history.rb
Overview
Abstract storage for command history
Direct Known Subclasses
Instance Method Summary collapse
- #<<(arg) ⇒ Object
- #commands ⇒ Object
- #commands=(cmds) ⇒ Object
-
#initialize ⇒ History
constructor
A new instance of History.
- #to_a ⇒ Object
- #to_json(*a) ⇒ Object
Constructor Details
#initialize ⇒ History
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 |
#commands ⇒ Object
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_a ⇒ Object
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 |