Sha256: 3d00b934a7b5a009fd3494a941bb6e0cd83cdf5f45b8bd78bcc295af58134a55
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
require 'net/telnet' module Reviewlette class Vacations def self.find_vacations(username) vacations = [] tn = Net::Telnet.new('Host' => 'present.suse.de', 'Port' => 9874, 'Binmode' => false) collect = false tn.cmd(username) do |data| data.split("\n").each do |l| collect = true if l =~ /^Absence/ next unless collect if l[0,1] == "-" collect = false next end dates = [] l.split(" ").each do |date| unless date =~ /#{Time.now.year}/ next end dates.push(date) end case dates.size when 1 vacations.push("#{dates[0]}") when 2 vacations.push("#{dates[0]} - #{dates[1]}") else end end end tn.close vacations end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reviewlette-0.0.6 | lib/reviewlette/vacations.rb |