Class: Rubygame::EventTriggers::KindOfTrigger

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygame/event_triggers.rb

Overview

KindOfTrigger is an event trigger which fires when the event is kind of the given class or module. (In other words, when event.kind_of?( kind ) is true.)

Contrast with InstanceOfTrigger.

Instance Method Summary collapse

Constructor Details

#initialize(kind) ⇒ KindOfTrigger

Initialize a new instance of KindOfTrigger with the given class or module.

kind

The class/module to check for. (Class or Module, required)



489
490
491
# File 'lib/rubygame/event_triggers.rb', line 489

def initialize( kind )
	@kind = kind
end

Instance Method Details

#match?(event) ⇒ Boolean

Returns true if the event is kind of the class/module.

Returns:

  • (Boolean)


495
496
497
# File 'lib/rubygame/event_triggers.rb', line 495

def match?( event )
	event.kind_of?( @kind )
end