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
-
#collective ⇒ Object
readonly
Returns the value of attribute collective.
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#equality ⇒ Object
readonly
Returns the value of attribute equality.
-
#maxlen ⇒ Object
readonly
Returns the value of attribute maxlen.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#nousermod ⇒ Object
readonly
Returns the value of attribute nousermod.
-
#obsolete ⇒ Object
readonly
Returns the value of attribute obsolete.
-
#oid ⇒ Object
readonly
Returns the value of attribute oid.
-
#ordering ⇒ Object
readonly
Returns the value of attribute ordering.
-
#singlevalue ⇒ Object
readonly
Returns the value of attribute singlevalue.
-
#substr ⇒ Object
readonly
Returns the value of attribute substr.
-
#sup ⇒ Object
readonly
Returns the value of attribute sup.
-
#syntax ⇒ Object
readonly
Returns the value of attribute syntax.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #changed ⇒ Object
-
#initialize(str) ⇒ AttributeType
constructor
A new instance of AttributeType.
- #name ⇒ Object
- #to_def ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(str) ⇒ AttributeType
Returns 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
#collective ⇒ Object (readonly)
Returns the value of attribute collective.
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def collective @collective end |
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def desc @desc end |
#equality ⇒ Object (readonly)
Returns the value of attribute equality.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def equality @equality end |
#maxlen ⇒ Object (readonly)
Returns the value of attribute maxlen.
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def maxlen @maxlen end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def names @names end |
#nousermod ⇒ Object (readonly)
Returns the value of attribute nousermod.
453 454 455 |
# File 'lib/ldap/server/schema.rb', line 453 def nousermod @nousermod end |
#obsolete ⇒ Object (readonly)
Returns the value of attribute obsolete.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def obsolete @obsolete end |
#oid ⇒ Object (readonly)
Returns the value of attribute oid.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def oid @oid end |
#ordering ⇒ Object (readonly)
Returns the value of attribute ordering.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def ordering @ordering end |
#singlevalue ⇒ Object (readonly)
Returns the value of attribute singlevalue.
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def singlevalue @singlevalue end |
#substr ⇒ Object (readonly)
Returns the value of attribute substr.
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def substr @substr end |
#sup ⇒ Object (readonly)
Returns the value of attribute sup.
451 452 453 |
# File 'lib/ldap/server/schema.rb', line 451 def sup @sup end |
#syntax ⇒ Object (readonly)
Returns the value of attribute syntax.
452 453 454 |
# File 'lib/ldap/server/schema.rb', line 452 def syntax @syntax end |
#usage ⇒ Object (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
#changed ⇒ Object
486 487 488 |
# File 'lib/ldap/server/schema.rb', line 486 def changed @def = nil end |
#name ⇒ Object
478 479 480 |
# File 'lib/ldap/server/schema.rb', line 478 def name @names.first end |
#to_def ⇒ Object
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 |
#to_s ⇒ Object
482 483 484 |
# File 'lib/ldap/server/schema.rb', line 482 def to_s (@names && @names.first) || @oid end |