From 01015aafcbee89361c2ea58f5a3318725a4f5998 Mon Sep 17 00:00:00 2001 From: sdalu Date: Wed, 14 May 2014 19:16:02 +0200 Subject: [PATCH] Adding Net::LDAP::Entry#first --- lib/net/ldap/entry.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/net/ldap/entry.rb b/lib/net/ldap/entry.rb index 616ffe7f..9ab4bb6d 100644 --- a/lib/net/ldap/entry.rb +++ b/lib/net/ldap/entry.rb @@ -113,6 +113,14 @@ def [](name) @myhash[name] || [] end + ## + # Read the first value for the provided attribute. The attribute name + # is canonicalized prior to reading. Returns nil if the attribute does + # not exist. + def first(name) + self[name].first + end + ## # Returns the first distinguished name (dn) of the Entry as a \String. def dn