Class: LDAP::Schema

### Home Classes Methods

### In Files

- lib/ldap/schema.rb

### Parent

Hash

### Methods

- ::new
- #attr
- #may
- #must
- #names
- #sup

### Class/Module Index

Quicksearch

- LDAP
- LDAP::Conn
- LDAP::Control
- LDAP::Entry
- LDAP::LDIF
- LDAP::LDIF::Entry
- LDAP::LDIF::LDIFError
- LDAP::LDIF::Mod
- LDAP::Mod
- LDAP::Record
- LDAP::Schema

No matching classes.

# LDAP::Schema

Retrieve and process information pertaining to LDAP schemas.

### Public Class Methods

new(entry) click to toggle source

    # File lib/ldap/schema.rb, line 16
    def initialize(entry)
      if( entry )
        entry.each do |key, vals|
          self[key] = vals
        end
      end
    end

### Public Instance Methods

attr(oc,at) click to toggle source

Return the list of attributes in object class `oc` that are of category `at`. `at` may be the string MUST, MAY or SUP.

    # File lib/ldap/schema.rb, line 34
    def attr(oc,at)
      self['objectClasses'].each do |s|
        if( s =~ /NAME\s+'#{oc}'/ )
          case s
          when /#{at}\s+\(([\w\d_\-\s\$]+)\)/ then return $1.split("$").collect{|attr| attr.strip}
          when /#{at}\s+([\w\d_\-]+)/ then return $1.split("$").collect{|attr| attr.strip}
          end
        end
      end

      return nil
    end

may(oc) click to toggle source

Return the list of attributes that an entry with object class `oc` may possess.

    # File lib/ldap/schema.rb, line 57
    def may(oc)
      attr(oc, "MAY")
    end

must(oc) click to toggle source

Return the list of attributes that an entry with object class `oc` must possess.

    # File lib/ldap/schema.rb, line 50
    def must(oc)
      attr(oc, "MUST")
    end

names(key) click to toggle source

Return the list of values related to the schema component given in `key`. See LDAP::Conn#schema for common values of `key`.

    # File lib/ldap/schema.rb, line 27
    def names(key)
      self[key].collect{|val| val =~ /NAME\s+'([\w\d_\-]+)'/; $1}
    end

sup(oc) click to toggle source

Return the superior object class of object class `oc`.

    # File lib/ldap/schema.rb, line 63
    def sup(oc)
      attr(oc, "SUP")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.