Class: ActiveLdap::Association::Collection
- Inherits:
-
Proxy
- Object
- Proxy
- ActiveLdap::Association::Collection
show all
- Includes:
- Enumerable
- Defined in:
- lib/active_ldap/association/collection.rb
Instance Method Summary
collapse
Methods inherited from Proxy
#===, #initialize, #loaded, #loaded?, #proxy_respond_to?, #reload, #respond_to?, #target, #target=
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class ActiveLdap::Association::Proxy
Instance Method Details
#<<(*entries) ⇒ Object
Also known as:
push, concat
18
19
20
|
# File 'lib/active_ldap/association/collection.rb', line 18
def <<(*entries)
add_entries(*entries)
end
|
#delete(*entries) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/active_ldap/association/collection.rb', line 28
def delete(*entries)
entries = flatten_deeper(entries).reject do |entry|
@target.delete(entry) if entry.new_entry?
entry.new_entry?
end
return if entries.empty?
delete_entries(entries)
entries.each do |entry|
@target.delete(entry)
end
end
|
#each(&block) ⇒ Object
24
25
26
|
# File 'lib/active_ldap/association/collection.rb', line 24
def each(&block)
to_ary.each(&block)
end
|
#exists? ⇒ Boolean
50
51
52
53
|
# File 'lib/active_ldap/association/collection.rb', line 50
def exists?
load_target
not @target.empty?
end
|
#replace(others) ⇒ Object
41
42
43
44
45
46
47
48
|
# File 'lib/active_ldap/association/collection.rb', line 41
def replace(others)
load_target
deleted_entries = @target - others
added_entries = others - @target
delete(deleted_entries)
concat(added_entries)
end
|
#reset ⇒ Object
13
14
15
16
|
# File 'lib/active_ldap/association/collection.rb', line 13
def reset
@target = []
@loaded = false
end
|
#to_ary ⇒ Object
8
9
10
11
|
# File 'lib/active_ldap/association/collection.rb', line 8
def to_ary
load_target
@target.to_ary
end
|