# class ActiveLdap::Schema::ObjectClass

### Constants

UNWRITABLE_MUST_ATTRIBUTES

### Attributes

super_classes[R]

### Public Class Methods

new(name, schema) click to toggle source
Calls superclass method ActiveLdap::Schema::Entry.new

    # File lib/active_ldap/schema.rb, line 648
    def initialize(name, schema)
      super(name, schema, "objectClasses")
    end

### Public Instance Methods

may(include_super_class=true) click to toggle source

    # File lib/active_ldap/schema.rb, line 664
    def may(include_super_class=true)
      if include_super_class
        @all_may
      else
        @may
      end
    end

must(include_super_class=true) click to toggle source

    # File lib/active_ldap/schema.rb, line 656
    def must(include_super_class=true)
      if include_super_class
        @all_must
      else
        @must
      end
    end

super_class?(object_class) click to toggle source

    # File lib/active_ldap/schema.rb, line 652
    def super_class?(object_class)
      @super_classes.include?(object_class)
    end

### Private Instance Methods

attribute(attribute_name, name=@name) click to toggle source

    # File lib/active_ldap/schema.rb, line 719
    def attribute(attribute_name, name=@name)
      @schema.object_class_attribute(name, attribute_name) +
        @schema.dit_content_rule_attribute(name, attribute_name)
    end

collect_attributes() click to toggle source

    # File lib/active_ldap/schema.rb, line 698
    def collect_attributes
      must = attribute('MUST').reject do |name|
        UNWRITABLE_MUST_ATTRIBUTES.include?(name)
      end.uniq
      must = must.collect {|name| @schema.attribute(name)}
      may = attribute('MAY').uniq.collect {|name| @schema.attribute(name)}

      all_must = must.dup
      all_may = may.dup
      @super_classes.each do |super_class|
        all_must.concat(super_class.must(false))
        all_may.concat(super_class.may(false))
      end

      # Clean out the dupes.
      all_must.uniq!
      all_may.uniq!

      [must, may, all_must, all_may]
    end

collect_info() click to toggle source

    # File lib/active_ldap/schema.rb, line 673
    def collect_info
      @description = attribute("DESC")[0]
      @super_classes = collect_super_classes
      @must, @may, @all_must, @all_may = collect_attributes
    end

collect_super_classes() click to toggle source

    # File lib/active_ldap/schema.rb, line 679
    def collect_super_classes
      super_classes = attribute('SUP')
      loop do
        start_size = super_classes.size
        new_super_classes = []
        super_classes.each do |super_class|
          new_super_classes.concat(attribute('SUP', super_class))
        end

        super_classes.concat(new_super_classes)
        super_classes.uniq!
        break if super_classes.size == start_size
      end
      super_classes.collect do |name|
        @schema.object_class(name)
      end
    end