lib/net/ldap/entry.rb in net-ldap-0.16.3 vs lib/net/ldap/entry.rb in net-ldap-0.17.0

- old
+ new

@@ -1,5 +1,7 @@ +require_relative 'dataset' + # -*- ruby encoding: utf-8 -*- ## # Objects of this class represent individual entries in an LDAP directory. # User code generally does not instantiate this class. Net::LDAP#search # provides objects of this class to user code, either as block parameters or @@ -132,10 +134,17 @@ def attribute_names @myhash.keys end ## + # Creates a duplicate of the internal Hash containing the attributes + # of the entry. + def to_h + @myhash.dup + end + + ## # Accesses each of the attributes present in the Entry. # # Calls a user-supplied block with each attribute in turn, passing two # arguments to the block: a Symbol giving the name of the attribute, and a # (possibly empty) \Array of data values. @@ -185,8 +194,10 @@ # Returns true if the symbol ends with an equal sign. def setter?(sym) sym.to_s[-1] == ?= end private :setter? -end # class Entry -require_relative 'dataset' unless defined? Net::LDAP::Dataset + def ==(other) + other.instance_of?(self.class) && @myhash == other.to_h + end +end # class Entry