Class: Rubygame::EventTriggers::InstanceOfTrigger
- Inherits:
-
Object
- Object
- Rubygame::EventTriggers::InstanceOfTrigger
- Defined in:
- lib/rubygame/event_triggers.rb
Overview
InstanceOfTrigger is an event trigger which fires when the event is an instance of the given class. (In other words, when event.instance_of?( klass ) is true.)
Contrast with KindOfTrigger.
Instance Method Summary collapse
-
#initialize(klass) ⇒ InstanceOfTrigger
constructor
Initialize a new instance of InstanceOfTrigger with the given class.
-
#match?(event) ⇒ Boolean
Returns true if the event is an instance of the class.
Constructor Details
#initialize(klass) ⇒ InstanceOfTrigger
Initialize a new instance of InstanceOfTrigger with the given class.
- klass
-
The class to check for. (Class, required)
291 292 293 |
# File 'lib/rubygame/event_triggers.rb', line 291 def initialize( klass ) @klass = klass end |
Instance Method Details
#match?(event) ⇒ Boolean
Returns true if the event is an instance of the class.
297 298 299 |
# File 'lib/rubygame/event_triggers.rb', line 297 def match?( event ) event.instance_of?( @klass ) end |