Parent

Included Modules

Class Index [+]

Quicksearch

ActiveLdap::EntryAttribute

Attributes

must[R]
may[R]
object_classes[R]
schemata[R]

Public Class Methods

new(schema, object_classes) click to toggle source
    # File lib/active_ldap/entry_attribute.rb, line 8
 8:     def initialize(schema, object_classes)
 9:       @schemata = {}
10:       @names = {}
11:       @normalized_names = {}
12:       @aliases = {}
13:       @must = []
14:       @may = []
15:       @object_classes = []
16:       register(schema.attribute('objectClass'))
17:       object_classes.each do |objc|
18:         # get all attributes for the class
19:         object_class = schema.object_class(objc)
20:         @object_classes << object_class
21:         @must.concat(object_class.must)
22:         @may.concat(object_class.may)
23:       end
24:       @must.uniq!
25:       @may.uniq!
26:       (@must + @may).each do |attr|
27:         # Update attr_method with appropriate
28:         register(attr)
29:       end
30:     end

Public Instance Methods

all_names() click to toggle source
    # File lib/active_ldap/entry_attribute.rb, line 59
59:     def all_names
60:       @names.keys + @aliases.keys
61:     end
names(normalize=false) click to toggle source
    # File lib/active_ldap/entry_attribute.rb, line 32
32:     def names(normalize=false)
33:       names = @names.keys
34:       if normalize
35:         names.collect do |name|
36:           normalize(name)
37:         end.uniq
38:       else
39:         names
40:       end
41:     end
normalize(name, allow_normalized_name=false) click to toggle source
    # File lib/active_ldap/entry_attribute.rb, line 43
43:     def normalize(name, allow_normalized_name=false)
44:       return name if name.nil?
45:       return nil if @names.empty? and @aliases.empty?
46:       name = name.to_s
47:       real_name = @names[name]
48:       real_name ||= @aliases[name.underscore]
49:       if real_name
50:         real_name
51:       elsif allow_normalized_name
52:         return nil if @normalized_names.empty?
53:         @normalized_names[normalize_attribute_name(name)]
54:       else
55:         nil
56:       end
57:     end
register(attribute) click to toggle source

register

Make a method entry for every alias of a valid attribute and map it onto the first attribute passed in.

    # File lib/active_ldap/entry_attribute.rb, line 67
67:     def register(attribute)
68:       real_name = attribute.name
69:       return if @schemata.has_key?(real_name)
70:       @schemata[real_name] = attribute
71:       ([real_name] + attribute.aliases).each do |name|
72:         @names[name] = real_name
73:         @aliases[name.underscore] = real_name
74:         @normalized_names[normalize_attribute_name(name)] = real_name
75:       end
76:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.