def event(name, transitions = {}, &block)
      detect_event_conflict!(name) if machine.auto_methods?

      if block_given?
        merger = ChoiceMerger.new(machine, name, transitions)
        merger.instance_eval(&block)
      else
        transition_builder = TransitionBuilder.new(machine, name, transitions)
        transition_builder.call(transitions)
      end
    end
def event(name, transitions = {}, &block)
      detect_event_conflict!(name) if machine.auto_methods?

      if block_given?
        merger = ChoiceMerger.new(machine, name, transitions)
        merger.instance_eval(&block)
      else
        transition_builder = TransitionBuilder.new(machine, name, transitions)
        transition_builder.call(transitions)
      end
    end
Create event and associate transition

 @example
   event :go, :green => :yellow
   event :go, :green => :yellow, if: :lights_on?

 @param [Symbol] name
   the event name
 @param [Hash] transitions
   the event transitions and conditions

 @return [Transition]

 @api public