Class: Kanrisuru::Core::System::Parser::W

Inherits:
Object
  • Object
show all
Defined in:
lib/kanrisuru/core/system/parsers/w.rb

Class Method Summary collapse

Class Method Details

.parse(command) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kanrisuru/core/system/parsers/w.rb', line 8

def self.parse(command)
  result_string = command.raw_result.join
  rows = result_string.split("\n")

  rows.map do |row|
    values = *row.split(/\s+/, 8)
    Kanrisuru::Core::System::UserLoggedIn.new(
      values[0],
      values[1],
      IPAddr.new(values[2]),
      values[3],
      values[4],
      values[5].to_f,
      values[6].to_f,
      values[7]
    )
  end
end