You must use #keys[0]
(or #keys.first
) to select the first key of the Hash.
The function #key(val)
does something different, returning the key corresponding to an occurrence of val
in the hash.
http://www.ruby-doc.org/core-2.0.0/Hash.html#method-i-key-3F
def read_client_keys
@clients.keys[0] # this should work
end