lib/net/ldap/connection.rb in net-ldap-0.16.2 vs lib/net/ldap/connection.rb in net-ldap-0.16.3

- old
+ new

@@ -179,11 +179,11 @@ # This is provided as a convenience method to make sure a connection # object gets closed without waiting for a GC to happen. Clients shouldn't # have to call it, but perhaps it will come in handy someday. #++ def close - return if @conn.nil? + return if !defined?(@conn) || @conn.nil? @conn.close @conn = nil end # Internal: Reads messages by ID from a queue, falling back to reading from @@ -298,11 +298,11 @@ control[0] = String(control[0]).to_ber, control[1] = String(control[1]).to_ber, control[2] = (control[2] == true).to_ber control.to_ber_sequence end - sort_control = [ + [ Net::LDAP::LDAPControls::SORT_REQUEST.to_ber, false.to_ber, sort_control_values.to_ber_sequence.to_s.to_ber, ].to_ber_sequence end @@ -608,11 +608,11 @@ write(request, nil, message_id) pdu = queued_read(message_id) if !pdu || pdu.app_tag != Net::LDAP::PDU::ExtendedResponse - raise Net::LDAP::ResponseMissingError, "response missing or invalid" + raise Net::LDAP::ResponseMissingOrInvalidError, "response missing or invalid" end pdu end @@ -708,9 +708,9 @@ private # Wrap around Socket.tcp to normalize with other Socket initializers class DefaultSocket def self.new(host, port, socket_opts = {}) - Socket.tcp(host, port, socket_opts) + Socket.tcp(host, port, **socket_opts) end end end # class Connection