Module: Alondra::ChangesPush

Defined in:
lib/alondra/changes_push.rb

Instance Method Summary collapse

Instance Method Details

#push(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/alondra/changes_push.rb', line 3

def push(*args)
  last_arg = args.last
  options = Hash === last_arg ? args.delete(last_arg) : {}

  args.each do |event_type|
    case event_type
    when :changes then
      ChangesCallbacks.push_updates(self, options)
      ChangesCallbacks.push_creations(self, options)
      ChangesCallbacks.push_destroys(self, options)
    when :updates then
      ChangesCallbacks.push_updates(self, options)
    when :creations then
      ChangesCallbacks.push_creations(self, options)
    when :destroys  then
      ChangesCallbacks.push_destroys(self, options)
    end
  end
end