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.



6
7
8
9
# File 'lib/eventception/listener_handler.rb', line 6

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

Instance Attribute Details

#listenerObject (readonly)

Returns the value of attribute listener.



3
4
5
# File 'lib/eventception/listener_handler.rb', line 3

def listener
  @listener
end

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/eventception/listener_handler.rb', line 4

def method
  @method
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/eventception/listener_handler.rb', line 15

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

#call(event) ⇒ Object



11
12
13
# File 'lib/eventception/listener_handler.rb', line 11

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/eventception/listener_handler.rb', line 19

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