def matches?(conditions)
    conditions.all? do |key, value|
      case key
      when :class, :type
        kind_of? value
      when :name
        name == value
      else
        # Simple cop-out.
        send(key) == value
      end
    end
  end
def matches?(conditions)
    conditions.all? do |key, value|
      case key
      when :class, :type
        kind_of? value
      when :name
        name == value
      else
        # Simple cop-out.
        send(key) == value
      end
    end
  end
Checks if the event meets a set of conditions.

 This is used in WebkitRemote::Client#wait_for.

 @param [Hash<Symbol, Object>] conditions the conditions that must be met
     by an event to get out of the waiting loop
 @option conditions [Class] class the class of events to wait for; this
     condition is met if the event's class is a sub-class of the given class
 @option conditions [Class] type synonym for class that can be used with the
     Ruby 1.9 hash syntax
 @option conditions [String] name the event's name, e.g.
     "Page.loadEventFired"
 @return [Boolean] true if this event matches all the given conditions