mirror of
https://github.com/vidarh/ruby-x11
synced 2024-11-16 07:48:12 +01:00
shortened and speedup code - removed method #displays which was just called from within the class
This commit is contained in:
parent
1fe1b8823d
commit
73349fe703
1 changed files with 6 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue