Improved the search-result handling
This commit is contained in:
parent
7be5474f06
commit
28185fdf0f
2 changed files with 20 additions and 15 deletions
|
@ -37,7 +37,7 @@ class LDAP
|
|||
|
||||
def initialize dn = nil
|
||||
@myhash = Hash.new {|k,v| k[v] = [] }
|
||||
self[:dn] = [dn]
|
||||
@myhash[:dn] = [dn]
|
||||
end
|
||||
|
||||
|
||||
|
@ -47,20 +47,27 @@ class LDAP
|
|||
end
|
||||
|
||||
def [] name
|
||||
unless name.is_a?(Symbol)
|
||||
name = name.to_s.downcase.intern
|
||||
end
|
||||
#unless name.is_a?(Symbol)
|
||||
# name = name.to_s.downcase.intern
|
||||
#end
|
||||
@myhash[name]
|
||||
end
|
||||
|
||||
def dn
|
||||
self[:dn].shift
|
||||
self[:dn][0]
|
||||
end
|
||||
|
||||
def attribute_names
|
||||
@myhash.keys
|
||||
end
|
||||
|
||||
def each
|
||||
if block_given?
|
||||
attribute_names.each {|a| yield a, self[a] }
|
||||
end
|
||||
end
|
||||
|
||||
alias_method :each_attribute, :each
|
||||
|
||||
end # class Entry
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue