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

- (Observer) initialize(binder)



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

def initialize(binder)
  @binder = binder
end

Instance Attribute Details

- (Object) binder (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

- (Object) after_create(rec)



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

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

- (Object) after_destroy(rec)



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

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

- (Object) after_update(rec)



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

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

- (Object) observed_class_inherited(subclass)

:nodoc:



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

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

- (Object) update(observed_method, 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