Class: Jah::Who

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/jah/commands/who.rb

Constant Summary

Constants included from Command

Command::COMM

Class Method Summary collapse

Methods included from Command

find, included

Class Method Details

.allObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jah/commands/who.rb', line 13

def self.all
  @who = `who`.to_a.map do |l|
    l = l.split(" ")

    hash = {}

    hash[:who] = l[0]
    hash[:tty] = l[1]
    2.times{ l.delete(l[0]) }
    hash[:date] = l.join(" ")
    hash
  end
end

.snapObject



7
8
9
10
11
# File 'lib/jah/commands/who.rb', line 7

def self.snap
  all.map do |w|
    "#{w[:who]} Logado via #{w[:terminal]} desde a data: #{w[:date]}"
  end.join("\n")
end