Class: Qcmd::History
- Inherits:
-
Object
- Object
- Qcmd::History
- Defined in:
- lib/qcmd/history.rb
Class Attribute Summary collapse
-
.commands ⇒ Object
Returns the value of attribute commands.
Class Method Summary collapse
Class Attribute Details
.commands ⇒ Object
Returns the value of attribute commands.
4 5 6 |
# File 'lib/qcmd/history.rb', line 4 def commands @commands end |
Class Method Details
.load ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/qcmd/history.rb', line 6 def load if File.exists?(Qcmd::Configuration.history_file) lines = File.new(Qcmd::Configuration.history_file, 'r').readlines else lines = [] end if lines lines.reverse[0..100].reverse.each {|hist| Readline::HISTORY.push(hist) } end end |
.push(command) ⇒ Object
21 22 23 |
# File 'lib/qcmd/history.rb', line 21 def push command Qcmd::Configuration.history.puts command end |