Class: Achoo::System::Wtmp
- Inherits:
-
Array
- Object
- Array
- Achoo::System::Wtmp
- Defined in:
- lib/achoo/system/wtmp.rb
Instance Method Summary collapse
-
#initialize(glob = '/var/log/wtmp*') ⇒ Wtmp
constructor
A new instance of Wtmp.
Constructor Details
#initialize(glob = '/var/log/wtmp*') ⇒ Wtmp
Returns a new instance of Wtmp.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/achoo/system/wtmp.rb', line 6 def initialize(glob='/var/log/wtmp*') super() chunk_size = Achoo::Binary::UTMPRecord.bin_size Dir.glob(glob).sort.reverse.each do |file| File.open(file, 'r') do |io| while (bytes = io.read(chunk_size)) self << Achoo::Binary::UTMPRecord.new(bytes) end end end end |