Module: ActiveLdap::ObjectClass
- Defined in:
- lib/active_ldap/object_class.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
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
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/active_ldap/object_class.rb', line 3 def self.included(base) base.extend(ClassMethods) end |
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.flatten).uniq) end |
#classes ⇒ Object
35 36 37 |
# File 'lib/active_ldap/object_class.rb', line 35 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.flatten).uniq) end |
#replace_class(*target_classes) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/active_ldap/object_class.rb', line 27 def replace_class(*target_classes) new_classes = target_classes.flatten.uniq assert_object_classes(new_classes) if new_classes.sort != classes.sort set_attribute('objectClass', new_classes) end end |