This is a class for representing ldapSyntax declarations in a Treequel::Schema.
The syntax's description
The syntax's extensions (as a String)
The syntax's oid
The schema the syntax belongs to
Create a new LDAPSyntax
# File lib/treequel/schema/ldapsyntax.rb, line 44 def initialize( schema, oid, desc=nil, extensions=nil ) @schema = schema @oid = oid @desc = desc @extensions = extensions super() end
Parse an LDAPSyntax entry from an ldapSyntax description from a schema.
# File lib/treequel/schema/ldapsyntax.rb, line 24 def self::parse( schema, description ) unless match = ( LDAP_SYNTAX_DESCRIPTION.match(description) ) raise Treequel::ParseError, "failed to parse syntax from %p" % [ description ] end oid, desc, extensions = match.captures # Treequel.logger.debug " parsed syntax: %p" % [ match.captures ] # Normalize the attributes desc = Treequel::Schema.unquote_desc( desc ) return self.new( schema, oid, desc, extensions ) end
Return a human-readable representation of the object suitable for debugging
# File lib/treequel/schema/ldapsyntax.rb, line 89 def inspect return "#<%s:0x%0x %s(%s)>" % [ self.class.name, self.object_id / 2, self.oid, self.desc, ] end
Returns the SyntaxDescription as a String, which is the RFC4512-style schema description.
# File lib/treequel/schema/ldapsyntax.rb, line 79 def to_s parts = [ self.oid ] parts << "DESC '%s'" % [ self.desc ] if self.desc parts << self.extensions.strip unless self.extensions.empty? return "( %s )" % [ parts.join(' ') ] end