diff --git a/bindings/ruby/examples/who.rb b/bindings/ruby/examples/who.rb new file mode 100644 index 00000000..ab29574b --- /dev/null +++ b/bindings/ruby/examples/who.rb @@ -0,0 +1,13 @@ +require 'rbsigar' + +def format_time(who) + return Time.at(who.time).strftime("%b %e %H:%M") +end + +sigar = Sigar.new + +whos = sigar.who_list + +whos.each do |who| + puts who.user + "\t" + who.device + "\t" + format_time(who) + who.host +end