Class: Bowline::Observable::Event

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(observable, type, callback = nil) ⇒ Event

Returns a new instance of Event.



18
19
20
21
22
# File 'lib/bowline/observer.rb', line 18

def initialize(observable, type, callback = nil)
  @observable = observable
  @type       = type
  @callback   = callback
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



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

def callback
  @callback
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#call(*args) ⇒ Object



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

def call(*args)
  @callback.call(*args)
end

#removeObject



28
29
30
# File 'lib/bowline/observer.rb', line 28

def remove
  @observable.remove(self)
end