shortened and speedup code - removed method #displays which was just called from within the class

This commit is contained in:
Matthias Beyer 2012-03-07 23:13:51 +01:00
parent 1fe1b8823d
commit 73349fe703

View file

@ -40,10 +40,13 @@ module X11
address = TCPSocket.gethostbyname(host) if family == :Internet # this line does nothing for now
auth_data = nil
displays.each do |entry|
auth_data = entry if display_id.to_i == entry.display.to_i
# with each entry from XAuthority file
until @file.eof?
r = read()
auth_data = r if display_id.to_i == f.display.to_i
end
reset
return auth_data
end
@ -56,14 +59,6 @@ module X11
AuthInfo[*auth_info]
end
# returns all entries from XAuthority file
def displays
collection = []
collection << read while !@file.eof?
reset
collection
end
def reset
@file.seek(0, IO::SEEK_SET)
end