Class: Eventception::ListenerHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/eventception/listener_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listener, method) ⇒ ListenerHandler

Returns a new instance of ListenerHandler



25
26
27
28
# File 'lib/eventception/listener_handler.rb', line 25

def initialize(listener, method)
  @listener = listener
  @method = method
end

Instance Attribute Details

#listenerObject (readonly)

Returns the value of attribute listener



22
23
24
# File 'lib/eventception/listener_handler.rb', line 22

def listener
  @listener
end

#methodObject (readonly)

Returns the value of attribute method



23
24
25
# File 'lib/eventception/listener_handler.rb', line 23

def method
  @method
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
# File 'lib/eventception/listener_handler.rb', line 34

def ==(other)
  eql?(other)
end

#call(event) ⇒ Object



30
31
32
# File 'lib/eventception/listener_handler.rb', line 30

def call(event)
  listener.public_send(method, event)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/eventception/listener_handler.rb', line 38

def eql?(other)
  listener == other.listener && method == other.method
end