def add_events(new_events)
      new_events.map do |new_event|
        # Check for other states that use a different class type for their name.
        # This typically prevents string / symbol misuse.
        if conflict = events.detect { |event| event.name.class != new_event.class }
          raise ArgumentError, "#{new_event.inspect} event defined as #{new_event.class}, #{conflict.name.inspect} defined as #{conflict.name.class}; all events must be consistent"
        end

        unless event = events[new_event]
          events << event = Event.new(self, new_event)
        end

        event
      end
    end
def add_events(new_events)
      new_events.map do |new_event|
        # Check for other states that use a different class type for their name.
        # This typically prevents string / symbol misuse.
        if conflict = events.detect { |event| event.name.class != new_event.class }
          raise ArgumentError, "#{new_event.inspect} event defined as #{new_event.class}, #{conflict.name.inspect} defined as #{conflict.name.class}; all events must be consistent"
        end

        unless event = events[new_event]
          events << event = Event.new(self, new_event)
        end

        event
      end
    end
Tracks the given set of events in the list of all known events for
 this machine