Class: Linux::Utmpx::UtmpxParser

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/linux/utmpx/parser.rb

Constant Summary collapse

UT_LINESIZE =
32
UT_NAMESIZE =
32
UT_HOSTSIZE =
256
UT_IDSIZE =
4

Instance Method Summary collapse

Instance Method Details

#hostObject



67
68
69
# File 'lib/linux/utmpx/parser.rb', line 67

def host
  ut_host
end

#idObject



63
64
65
# File 'lib/linux/utmpx/parser.rb', line 63

def id
  ut_id
end

#lineObject



55
56
57
# File 'lib/linux/utmpx/parser.rb', line 55

def line
  ut_line
end

#pidObject



51
52
53
# File 'lib/linux/utmpx/parser.rb', line 51

def pid
  ut_pid
end

#timeObject



40
41
42
# File 'lib/linux/utmpx/parser.rb', line 40

def time
  Time.at(ut_tv.tv_sec, ut_tv.tv_usec)
end

#typeObject



44
45
46
47
48
49
# File 'lib/linux/utmpx/parser.rb', line 44

def type
  Linux::Utmpx::Type.constants.each do |sym|
    return sym if Linux::Utmpx::Type.const_get(sym) == ut_type
  end
  ut_type
end

#userObject



59
60
61
# File 'lib/linux/utmpx/parser.rb', line 59

def user
  ut_user
end