Sha256: f103b9afe77d5ef81a391aea84ccc2f7140e46b1bfe548ab6c3951504400a4d8

Contents?: true

Size: 520 Bytes

Versions: 12

Compression:

Stored size: 520 Bytes

Contents

module Qcmd
  class History
    class << self
      attr_accessor :commands

      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


      def push command
        Qcmd::Configuration.history.puts command
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
qcmd-0.2.0 lib/qcmd/history.rb
qcmd-0.1.16 lib/qcmd/history.rb
qcmd-0.1.16.pre2 lib/qcmd/history.rb
qcmd-0.1.16.pre lib/qcmd/history.rb
qcmd-0.1.15 lib/qcmd/history.rb
qcmd-0.1.14 lib/qcmd/history.rb
qcmd-0.1.13 lib/qcmd/history.rb
qcmd-0.1.12 lib/qcmd/history.rb
qcmd-0.1.11 lib/qcmd/history.rb
qcmd-0.1.10 lib/qcmd/history.rb
qcmd-0.1.9 lib/qcmd/history.rb
qcmd-0.1.8 lib/qcmd/history.rb