Class: Ripple::Associations::ManyLinkedProxy
Instance Attribute Summary
Attributes inherited from Proxy
#owner, #reflection, #target
Instance Method Summary
collapse
Methods included from Linked
#include?, #keys, #replace, #replace_links
Methods included from Many
#to_ary
#build, #create, #create!
Methods inherited from Proxy
#===, #blank?, #has_changed_documents?, #initialize, #inspect, #loaded, #loaded?, #nil?, #present?, #proxy_respond_to?, #reload, #replace, #respond_to?, #send
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Ripple::Associations::Proxy
Instance Method Details
#<<(value) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/ripple/associations/many_linked_proxy.rb', line 16
def <<(value)
if loaded?
new_target = @target.concat(Array.wrap(value))
replace new_target
else
@reflection.verify_type!([value], @owner)
@owner.robject.links << value.to_link(@reflection.link_tag)
appended_documents << value
@keys = nil
end
self
end
|
11
12
13
14
|
# File 'lib/ripple/associations/many_linked_proxy.rb', line 11
def count
keys.size
end
|
#delete(value) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/ripple/associations/many_linked_proxy.rb', line 30
def delete(value)
load_target
@target.delete(value)
replace @target
self
end
|
#loaded_documents ⇒ Object
42
43
44
|
# File 'lib/ripple/associations/many_linked_proxy.rb', line 42
def loaded_documents
(super + appended_documents).uniq
end
|
37
38
39
40
|
# File 'lib/ripple/associations/many_linked_proxy.rb', line 37
def reset
@appended_documents = nil
super
end
|