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?.
- #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
- #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.
356 357 358 |
# File 'lib/active_ldap/schema.rb', line 356 def initialize(name, schema) super(name, schema, "attributeTypes") end |
Instance Attribute Details
#super_attribute ⇒ Object (readonly)
Returns the value of attribute super_attribute.
355 356 357 |
# File 'lib/active_ldap/schema.rb', line 355 def super_attribute @super_attribute end |
Instance Method Details
#binary? ⇒ Boolean
binary?
Returns true if the given attribute’s syntax is X-NOT-HUMAN-READABLE or X-BINARY-TRANSFER-REQUIRED
381 382 383 |
# File 'lib/active_ldap/schema.rb', line 381 def binary? @binary end |
#binary_required? ⇒ Boolean
binary_required?
Returns true if the value MUST be transferred in binary
388 389 390 |
# File 'lib/active_ldap/schema.rb', line 388 def binary_required? @binary_required end |
#human_attribute_description ⇒ Object
427 428 429 |
# File 'lib/active_ldap/schema.rb', line 427 def human_attribute_description self.class.human_attribute_description(self) end |
#human_attribute_name ⇒ Object
423 424 425 |
# File 'lib/active_ldap/schema.rb', line 423 def human_attribute_name self.class.human_attribute_name(self) end |
#normalize_value(value) ⇒ Object
415 416 417 |
# File 'lib/active_ldap/schema.rb', line 415 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
364 365 366 |
# File 'lib/active_ldap/schema.rb', line 364 def read_only? @read_only end |
#single_value? ⇒ Boolean
single_value?
Returns true if an attribute can only have one value defined SINGLE-VALUE
373 374 375 |
# File 'lib/active_ldap/schema.rb', line 373 def single_value? @single_value end |
#syntax ⇒ Object
392 393 394 |
# File 'lib/active_ldap/schema.rb', line 392 def syntax @derived_syntax end |
#syntax_description ⇒ Object
419 420 421 |
# File 'lib/active_ldap/schema.rb', line 419 def syntax_description send_to_syntax(nil, :description) end |
#type_cast(value) ⇒ Object
411 412 413 |
# File 'lib/active_ldap/schema.rb', line 411 def type_cast(value) send_to_syntax(value, :type_cast, value) end |
#valid?(value) ⇒ Boolean
396 397 398 |
# File 'lib/active_ldap/schema.rb', line 396 def valid?(value) validate(value).nil? end |
#validate(value) ⇒ Object
400 401 402 403 404 405 406 407 408 409 |
# File 'lib/active_ldap/schema.rb', line 400 def validate(value) error_info = validate_each_value(value) return error_info if error_info begin normalize_value(value) nil rescue AttributeValueInvalid [$!.] end end |