ruby-activeldap 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -612,9 +612,7 @@ module ActiveLDAP
612
612
 
613
613
  # Make sure all MUST attributes have a value
614
614
  @data['objectClass'].each do |objc|
615
- must = Base.schema.attr('objectClasses', objc, 'MUST')
616
- may = Base.schema.attr('objectClasses', objc, 'MAY')
617
- must.each do |req_attr|
615
+ @must.each do |req_attr|
618
616
  deref = @attr_methods[req_attr]
619
617
  if @data[deref] == []
620
618
  raise AttributeEmpty,
@@ -887,13 +885,17 @@ module ActiveLDAP
887
885
  # Build |data| from schema
888
886
  # clear attr_method mapping first
889
887
  @attr_methods = {}
890
- attributes = []
888
+ @must = []
889
+ @may = []
891
890
  new_oc.each do |objc|
892
891
  # get all attributes for the class
893
- attributes += Base.schema.class_attributes(objc.to_s)
892
+ attributes = Base.schema.class_attributes(objc.to_s)
893
+ @must += attributes[:must]
894
+ @may += attributes[:may]
894
895
  end
895
- attributes.uniq
896
- attributes.each do |attr|
896
+ @must.uniq!
897
+ @may.uniq!
898
+ (@must+@may).each do |attr|
897
899
  # Update attr_method with appropriate
898
900
  define_attribute_methods(attr)
899
901
  end
@@ -151,8 +151,12 @@ module LDAP
151
151
  return @@class_cache[objc]
152
152
  end
153
153
 
154
+ # Setup the cache
155
+ @@class_cache[objc] = {}
156
+
154
157
  # First get all the current level attributes
155
- @@class_cache[objc] = attr('objectClasses', objc, 'MUST') + attr('objectClasses', objc, 'MAY')
158
+ @@class_cache[objc] = {:must => attr('objectClasses', objc, 'MUST'),
159
+ :may => attr('objectClasses', objc, 'MAY')}
156
160
 
157
161
  # Now add all attributes from the parent object (SUPerclasses)
158
162
  # Hopefully an iterative approach will be pretty speedy
@@ -166,15 +170,17 @@ module LDAP
166
170
  new_sups += attr('objectClasses', sup, 'SUP')
167
171
  end
168
172
  sups += new_sups
169
- sups = sups.uniq
173
+ sups.uniq!
170
174
  break if sups.size == start_size
171
175
  end
172
176
  sups.each do |sup|
173
- @@class_cache[objc] += attr('objectClasses', sup, 'MUST') + attr('objectClasses', sup, 'MAY')
177
+ @@class_cache[objc][:must] += attr('objectClasses', sup, 'MUST')
178
+ @@class_cache[objc][:may] += attr('objectClasses', sup, 'MAY')
174
179
  end
175
180
 
176
181
  # Clean out the dupes.
177
- @@class_cache[objc] = @@class_cache[objc].uniq
182
+ @@class_cache[objc][:must].uniq!
183
+ @@class_cache[objc][:may].uniq!
178
184
 
179
185
  # Return the cached value
180
186
  return @@class_cache[objc].dup
data/lib/activeldap.rb CHANGED
@@ -898,7 +898,7 @@ require 'activeldap/configuration'
898
898
  require 'activeldap/schema2'
899
899
 
900
900
  module ActiveLDAP
901
- VERSION = "0.5.0"
901
+ VERSION = "0.5.1"
902
902
  end
903
903
 
904
904
  ActiveLDAP::Base.class_eval do
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: ruby-activeldap
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2004-10-21
6
+ version: 0.5.1
7
+ date: 2004-10-22
8
8
  summary: Ruby/ActiveLDAP is a object-oriented API to LDAP
9
9
  require_paths:
10
10
  - lib