class ActiveLdap::Schema::ObjectClass

def attribute(attribute_name, name=@name)

def attribute(attribute_name, name=@name)
  @schema.object_class_attribute(name, attribute_name) +
    @schema.dit_content_rule_attribute(name, attribute_name)
end

def collect_attributes

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

def collect_info

def collect_info
  @description = attribute("DESC")[0]
  @super_classes = collect_super_classes
  @must, @may, @all_must, @all_may = collect_attributes
end

def collect_super_classes

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

def initialize(name, schema)

def initialize(name, schema)
  super(name, schema, "objectClasses")
end

def may(include_super_class=true)

def may(include_super_class=true)
  if include_super_class
    @all_may
  else
    @may
  end
end

def must(include_super_class=true)

def must(include_super_class=true)
  if include_super_class
    @all_must
  else
    @must
  end
end

def super_class?(object_class)

def super_class?(object_class)
  @super_classes.include?(object_class)
end