Class: Bowline::Binders::Observer

Inherits:
Object
  • Object
show all
Defined in:
lib/bowline/binders/observer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binder) ⇒ Observer

Returns a new instance of Observer.



5
6
7
# File 'lib/bowline/binders/observer.rb', line 5

def initialize(binder)
  @binder = binder
end

Instance Attribute Details

#binderObject (readonly)

Returns the value of attribute binder.



4
5
6
# File 'lib/bowline/binders/observer.rb', line 4

def binder
  @binder
end

Instance Method Details

#after_create(rec) ⇒ Object



9
10
11
# File 'lib/bowline/binders/observer.rb', line 9

def after_create(rec)
  binder.created(rec)
end

#after_destroy(rec) ⇒ Object



17
18
19
# File 'lib/bowline/binders/observer.rb', line 17

def after_destroy(rec)
  binder.destroyed(rec)
end

#after_update(rec) ⇒ Object



13
14
15
# File 'lib/bowline/binders/observer.rb', line 13

def after_update(rec)
  binder.updated(rec)
end

#observed_class_inherited(subclass) ⇒ Object

:nodoc:



25
26
27
# File 'lib/bowline/binders/observer.rb', line 25

def observed_class_inherited(subclass) #:nodoc:
  subclass.add_observer(self)
end

#update(observed_method, object) ⇒ Object

:nodoc:



21
22
23
# File 'lib/bowline/binders/observer.rb', line 21

def update(observed_method, object) #:nodoc:
  send(observed_method, object) if respond_to?(observed_method)
end