This is a class for representing matchingRuleUse declarations in a Treequel::Schema.
The OIDs of the attributes the matchingRuleUse applies to
The matchingRuleUse's description
The matchingRuleUse's extensions (as a String)
The Array of the matchingRuleUse's names
The matchingRuleUse's oid
The schema the matchingRuleUse belongs to
Create a new MatchingRuleUse
# File lib/treequel/schema/matchingruleuse.rb, line 46 def initialize( schema, oid, attr_oids, names=nil, desc=nil, obsolete=false, extensions=nil ) @schema = schema @oid = oid @names = names @desc = desc @obsolete = obsolete ? true : false @attr_oids = attr_oids @extensions = extensions super() end
Parse an MatchingRuleUse entry from a matchingRuleUse description from a schema.
# File lib/treequel/schema/matchingruleuse.rb, line 24 def self::parse( schema, description ) unless match = ( LDAP_MATCHING_RULE_USE_DESCRIPTION.match(description) ) raise Treequel::ParseError, "failed to parse matchingRuleUse from %p" % [ description ] end oid, names, desc, obsolete, attr_oids, extensions = match.captures # Treequel.logger.debug " parsed matchingRuleUse: %p" % [ match.captures ] # Normalize the attributes names = Treequel::Schema.parse_names( names ) desc = Treequel::Schema.unquote_desc( desc ) attr_oids = Treequel::Schema.parse_oids( attr_oids ) return self.new( schema, oid, attr_oids, names, desc, obsolete, extensions ) end
Return Treequel::Schema::AttributeType objects for each of the types this MatchingRuleUse applies to.
# File lib/treequel/schema/matchingruleuse.rb, line 132 def attribute_types return self.attr_oids.collect {|oid| self.schema.attribute_types[oid] } end
Return a human-readable representation of the object suitable for debugging
# File lib/treequel/schema/matchingruleuse.rb, line 118 def inspect return "#<%s:0x%0x %s(%s) %p -> %p >" % [ self.class.name, self.object_id / 2, self.name, self.oid, self.desc, self.attr_oids, ] end
Return the first of the matchingRuleUse's names, if it has any, or
nil
.
# File lib/treequel/schema/matchingruleuse.rb, line 88 def name return self.names.first end
Returns the matchingRuleUse as a String, which is the RFC4512-style schema description.
# File lib/treequel/schema/matchingruleuse.rb, line 103 def to_s parts = [ self.oid ] parts << "NAME %s" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty? parts << "DESC '%s'" % [ self.desc ] if self.desc parts << "OBSOLETE" if self.obsolete? parts << "APPLIES %s" % [ Treequel::Schema.oids(self.attr_oids) ] parts << self.extensions.strip unless self.extensions.empty? return "( %s )" % [ parts.join(' ') ] end