class ArSync::Collection
Attributes
klass[R]
limit[R]
name[R]
order[R]
Public Class Methods
_sync_child_info(key)
click to toggle source
# File lib/ar_sync/collection.rb, line 43 def self._sync_child_info(key) _sync_children_info[key] end
_sync_children_info()
click to toggle source
# File lib/ar_sync/collection.rb, line 39 def self._sync_children_info @sync_children_info ||= {} end
defined_collections()
click to toggle source
# File lib/ar_sync/collection.rb, line 21 def self.defined_collections @defined_collections ||= {} end
find(klass, name)
click to toggle source
# File lib/ar_sync/collection.rb, line 25 def self.find(klass, name) defined_collections[[klass, name]] end
new(klass, name, limit: nil, order: nil)
click to toggle source
# File lib/ar_sync/collection.rb, line 5 def initialize(klass, name, limit: nil, order: nil) @klass = klass @name = name @limit = limit @order = order self.class.defined_collections[[klass, name]] = self define_singleton_method(name) { to_a } end
Public Instance Methods
_sync_notify_child_added(child, _name, to_user)
click to toggle source
# File lib/ar_sync/collection.rb, line 31 def _sync_notify_child_added(child, _name, to_user) ArSync.sync_send to: self, action: :add, model: child, path: :collection, to_user: to_user end
_sync_notify_child_changed(_name, _to_user)
click to toggle source
# File lib/ar_sync/collection.rb, line 29 def _sync_notify_child_changed(_name, _to_user); end
_sync_notify_child_removed(child, _name, to_user, _owned)
click to toggle source
# File lib/ar_sync/collection.rb, line 35 def _sync_notify_child_removed(child, _name, to_user, _owned) ArSync.sync_send to: self, action: :remove, model: child, path: :collection, to_user: to_user end
to_a()
click to toggle source
# File lib/ar_sync/collection.rb, line 14 def to_a all = klass.all all = all.order id: order if order all = all.limit limit if limit all end