Use `<` operator instead of explicitly checking inheritance in `superclass`

pull/11892/head
Javier Torres 8 years ago
parent 23bc76bec1
commit 6306d68532

@ -18,7 +18,7 @@ module CartoGearsApi
# event_manager.subscribe(CartoGearsApi::Events::UserCreationEvent) { |e| puts e.user.username }
def subscribe(event_type, &block)
raise ArgumentError.new('block is mandatory') unless block
raise ArgumentError.new('event_type must be a subclass of BaseEvent') unless event_type.superclass == BaseEvent
raise ArgumentError.new('event_type must be a subclass of BaseEvent') unless event_type < BaseEvent
listeners_for(event_type).append(block)
[event_type, block]
end

Loading…
Cancel
Save