Module: WisperEvent::Patches::Events

Defined in:
lib/wisper_event/patches/events.rb

Instance Method Summary collapse

Instance Method Details

#include?(event) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wisper_event/patches/events.rb', line 6

def include?(event)
  if event.is_a?(String) || event.is_a?(Symbol)
    super
  # Structured event
  elsif list.is_a?(Class)
    event.is_a?(list)
  elsif list.is_a?(Enumerable) && list.any? { |item| item.is_a?(Class) }
    list.any? { |item| item.is_a?(Class) && event.is_a?(item) }
  else
    super
  end
end