Class: LDAP::Server::Schema::AttributeType
- Inherits:
-
Object
- Object
- LDAP::Server::Schema::AttributeType
- Defined in:
- lib/ldap/server/schema.rb
Overview
Class holding an instance of an AttributeTypeDescription (RFC2252 4.2)
Instance Attribute Summary (collapse)
-
- (Object) collective
readonly
Returns the value of attribute collective.
-
- (Object) desc
readonly
Returns the value of attribute desc.
-
- (Object) equality
readonly
Returns the value of attribute equality.
-
- (Object) maxlen
readonly
Returns the value of attribute maxlen.
-
- (Object) names
readonly
Returns the value of attribute names.
-
- (Object) nousermod
readonly
Returns the value of attribute nousermod.
-
- (Object) obsolete
readonly
Returns the value of attribute obsolete.
-
- (Object) oid
readonly
Returns the value of attribute oid.
-
- (Object) ordering
readonly
Returns the value of attribute ordering.
-
- (Object) singlevalue
readonly
Returns the value of attribute singlevalue.
-
- (Object) substr
readonly
Returns the value of attribute substr.
-
- (Object) sup
readonly
Returns the value of attribute sup.
-
- (Object) syntax
readonly
Returns the value of attribute syntax.
-
- (Object) usage
readonly
Returns the value of attribute usage.
Instance Method Summary (collapse)
- - (Object) changed
-
- (AttributeType) initialize(str)
constructor
A new instance of AttributeType.
- - (Object) name
- - (Object) to_def
- - (Object) to_s
Constructor Details
- (AttributeType) initialize(str)
A new instance of AttributeType
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/ldap/server/schema.rb', line 455 def initialize(str) m = LDAP::Server::Syntax::AttributeTypeDescription.match(str) raise LDAP::ResultError::InvalidAttributeSyntax, "Bad AttributeTypeDescription #{str.inspect}" unless m @oid = m[1] @names = (m[2]||"").scan(/'(.*?)'/).flatten @desc = m[3] @obsolete = ! m[4].nil? @sup = m[5] @equality = m[6] @ordering = m[7] @substr = m[8] @syntax = m[9] @maxlen = m[10] && m[10].to_i @singlevalue = ! m[11].nil? @collective = ! m[12].nil? @nousermod = ! m[13].nil? @usage = m[14] && m[14].intern # This is the cache of the stringified version. Rather than # initialize to str, we set nil to force it to be rebuilt @def = nil end |
Instance Attribute Details
- (Object) collective (readonly)
Returns the value of attribute collective
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def collective @collective end |
- (Object) desc (readonly)
Returns the value of attribute desc
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def desc @desc end |
- (Object) equality (readonly)
Returns the value of attribute equality
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def equality @equality end |
- (Object) maxlen (readonly)
Returns the value of attribute maxlen
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def maxlen @maxlen end |
- (Object) names (readonly)
Returns the value of attribute names
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def names @names end |
- (Object) nousermod (readonly)
Returns the value of attribute nousermod
453 454 455 |
# File 'lib/ldap/server/schema.rb', line 453 def nousermod @nousermod end |
- (Object) obsolete (readonly)
Returns the value of attribute obsolete
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def obsolete @obsolete end |
- (Object) oid (readonly)
Returns the value of attribute oid
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def oid @oid end |
- (Object) ordering (readonly)
Returns the value of attribute ordering
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def ordering @ordering end |
- (Object) singlevalue (readonly)
Returns the value of attribute singlevalue
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def singlevalue @singlevalue end |
- (Object) substr (readonly)
Returns the value of attribute substr
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def substr @substr end |
- (Object) sup (readonly)
Returns the value of attribute sup
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def sup @sup end |
- (Object) syntax (readonly)
Returns the value of attribute syntax
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def syntax @syntax end |
- (Object) usage (readonly)
Returns the value of attribute usage
453 454 455 |
# File 'lib/ldap/server/schema.rb', line 453 def usage @usage end |
Instance Method Details
- (Object) changed
486 487 488 |
# File 'lib/ldap/server/schema.rb', line 486 def changed @def = nil end |
- (Object) name
478 479 480 |
# File 'lib/ldap/server/schema.rb', line 478 def name @names.first end |
- (Object) to_def
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/ldap/server/schema.rb', line 490 def to_def return @def if @def ans = "( #{@oid} " if @names.nil? or @names.empty? # nothing elsif @names.size == 1 ans << "NAME '#{@names.first}' " else ans << "NAME ( " @names.each { |n| ans << "'#{n}' " } ans << ") " end ans << "DESC '#{@desc}' " if @desc ans << "OBSOLETE " if @obsolete ans << "SUP #{@sup} " if @sup # oid ans << "EQUALITY #{@equality} " if @equality # oid ans << "ORDERING #{@ordering} " if @ordering # oid ans << "SUBSTR #{@substr} " if @substr # oid ans << "SYNTAX #{@syntax}#{@maxlen && "{#{@maxlen}}"} " if @syntax ans << "SINGLE-VALUE " if @singlevalue ans << "COLLECTIVE " if @collective ans << "NO-USER-MODIFICATION " if @nousermod ans << "USAGE #{@usage} " if @usage ans << ")" @def = ans end |
- (Object) to_s
482 483 484 |
# File 'lib/ldap/server/schema.rb', line 482 def to_s (@names && @names.first) || @oid end |