Class: ActiveLdap::Schema::Attribute
- Includes:
- GetTextSupport, HumanReadable
- Defined in:
- lib/active_ldap/schema.rb
Instance Attribute Summary collapse
-
#super_attribute ⇒ Object
readonly
Returns the value of attribute super_attribute.
Attributes inherited from Entry
#aliases, #description, #id, #name
Instance Method Summary collapse
-
#binary? ⇒ Boolean
binary?.
-
#binary_required? ⇒ Boolean
binary_required?.
-
#directory_operation? ⇒ Boolean
directory_operation?.
- #human_attribute_description ⇒ Object
- #human_attribute_name ⇒ Object
-
#initialize(name, schema) ⇒ Attribute
constructor
A new instance of Attribute.
- #normalize_value(value) ⇒ Object
-
#read_only? ⇒ Boolean
read_only?.
-
#single_value? ⇒ Boolean
single_value?.
- #syntax ⇒ Object
- #syntax_description ⇒ Object
- #to_hash ⇒ Object
- #type_cast(value) ⇒ Object
- #valid?(value) ⇒ Boolean
- #validate(value) ⇒ Object
Methods included from HumanReadable
Methods included from GetTextSupport
Methods inherited from Entry
Constructor Details
#initialize(name, schema) ⇒ Attribute
Returns a new instance of Attribute.
398 399 400 |
# File 'lib/active_ldap/schema.rb', line 398 def initialize(name, schema) super(name, schema, "attributeTypes") end |
Instance Attribute Details
#super_attribute ⇒ Object (readonly)
Returns the value of attribute super_attribute.
397 398 399 |
# File 'lib/active_ldap/schema.rb', line 397 def super_attribute @super_attribute end |
Instance Method Details
#binary? ⇒ Boolean
binary?
Returns true if the given attribute’s syntax is binary syntax, X-NOT-HUMAN-READABLE or X-BINARY-TRANSFER-REQUIRED
423 424 425 |
# File 'lib/active_ldap/schema.rb', line 423 def binary? @binary end |
#binary_required? ⇒ Boolean
binary_required?
Returns true if the value MUST be transferred in binary
430 431 432 |
# File 'lib/active_ldap/schema.rb', line 430 def binary_required? @binary_required end |
#directory_operation? ⇒ Boolean
directory_operation?
Returns true if an attribute is directory operation. It means that USAGE contains directoryOperation.
438 439 440 |
# File 'lib/active_ldap/schema.rb', line 438 def directory_operation? @directory_operation end |
#human_attribute_description ⇒ Object
477 478 479 |
# File 'lib/active_ldap/schema.rb', line 477 def human_attribute_description self.class.human_attribute_description(self) end |
#human_attribute_name ⇒ Object
473 474 475 |
# File 'lib/active_ldap/schema.rb', line 473 def human_attribute_name self.class.human_attribute_name(self) end |
#normalize_value(value) ⇒ Object
465 466 467 |
# File 'lib/active_ldap/schema.rb', line 465 def normalize_value(value) normalize_value_internal(value, false) end |
#read_only? ⇒ Boolean
read_only?
Returns true if an attribute is read-only NO-USER-MODIFICATION
406 407 408 |
# File 'lib/active_ldap/schema.rb', line 406 def read_only? @read_only end |
#single_value? ⇒ Boolean
single_value?
Returns true if an attribute can only have one value defined SINGLE-VALUE
415 416 417 |
# File 'lib/active_ldap/schema.rb', line 415 def single_value? @single_value end |
#syntax ⇒ Object
442 443 444 |
# File 'lib/active_ldap/schema.rb', line 442 def syntax @derived_syntax end |
#syntax_description ⇒ Object
469 470 471 |
# File 'lib/active_ldap/schema.rb', line 469 def syntax_description send_to_syntax(nil, :description) end |
#to_hash ⇒ Object
481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/active_ldap/schema.rb', line 481 def to_hash { :read_only => read_only?, :single_value => single_value?, :binary => binary?, :binary_required => binary_required?, :directory_operation => directory_operation?, :syntax => syntax, :syntax_description => syntax_description, } end |
#type_cast(value) ⇒ Object
461 462 463 |
# File 'lib/active_ldap/schema.rb', line 461 def type_cast(value) send_to_syntax(value, :type_cast, value) end |
#valid?(value) ⇒ Boolean
446 447 448 |
# File 'lib/active_ldap/schema.rb', line 446 def valid?(value) validate(value).nil? end |
#validate(value) ⇒ Object
450 451 452 453 454 455 456 457 458 459 |
# File 'lib/active_ldap/schema.rb', line 450 def validate(value) error_info = validate_each_value(value) return error_info if error_info begin normalize_value(value) nil rescue AttributeValueInvalid [$!.] end end |