Module: ActiveLdap::ObjectClass
- Defined in:
- lib/active_ldap/object_class.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #add_class(*target_classes) ⇒ Object
- #classes ⇒ Object
- #ensure_recommended_classes ⇒ Object
- #remove_class(*target_classes) ⇒ Object
- #replace_class(*target_classes) ⇒ Object (also: #classes=)
Instance Method Details
#add_class(*target_classes) ⇒ Object
15 16 17 |
# File 'lib/active_ldap/object_class.rb', line 15 def add_class(*target_classes) replace_class(classes + target_classes) end |
#classes ⇒ Object
41 42 43 |
# File 'lib/active_ldap/object_class.rb', line 41 def classes (get_attribute('objectClass', true) || []).dup end |
#ensure_recommended_classes ⇒ Object
19 20 21 |
# File 'lib/active_ldap/object_class.rb', line 19 def ensure_recommended_classes add_class(self.class.recommended_classes) end |
#remove_class(*target_classes) ⇒ Object
23 24 25 |
# File 'lib/active_ldap/object_class.rb', line 23 def remove_class(*target_classes) replace_class(classes - target_classes) end |
#replace_class(*target_classes) ⇒ Object Also known as: classes=
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_ldap/object_class.rb', line 27 def replace_class(*target_classes) new_classes = target_classes.flatten.compact.uniq assert_object_classes(new_classes) if new_classes.sort != classes.sort original_attributes = must + may set_attribute('objectClass', new_classes) clear_object_class_based_cache new_attributes = must + may removed_attributes = original_attributes - new_attributes clear_removed_attributes_data(removed_attributes) end end |