Class | Rubygame::EventTriggers::AttrTrigger |
In: |
lib/rubygame/event_triggers.rb
lib/rubygame/event_triggers.rb |
Parent: | Object |
AttrTrigger is an event trigger which fires when an event has the expected value(s) for one or more attributes.
AttrTrigger stores a Hash of :attr => value pairs, and checks each event to see if event.attr returns value. If all attributes have the expected value, the trigger fires.
Initialize a new instance of AttrTrigger with a Hash of one or more :attr => value pairs.
attributes: | The attributes / value pairs to check. (Hash, required) |
Example:
# Matches if event.color returns :red and # event.size returns :big AttrTrigger.new( :color => :red, :size => :big )
Initialize a new instance of AttrTrigger with a Hash of one or more :attr => value pairs.
attributes: | The attributes / value pairs to check. (Hash, required) |
Example:
# Matches if event.color returns :red and # event.size returns :big AttrTrigger.new( :color => :red, :size => :big )
Returns true if, for every :attr => value pair, the event responds to :attr and calling event.attr returns value.
Returns false if any of the attributes is not the expected value.