Skip to content

Commit

Permalink
Added docs for InstanceOfTrigger.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacius committed Sep 6, 2008
1 parent 3c4e9c0 commit d46544c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/rubygame/event_triggers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,26 @@ def match?( event )



#
# 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.
#
class InstanceOfTrigger

# Initialize a new instance of InstanceOfTrigger with the
# given class.
#
# * klass:: The class to check for. (Class, required)
#
def initialize( klass )
@klass = klass
end

# Returns true if the event is an instance of the class.
#
def match?( event )
event.instance_of?( @klass )
end
Expand Down

0 comments on commit d46544c

Please sign in to comment.