def draw(graph_options = {})
      name = graph_options.delete(:name) || "#{owner_class.name}_#{self.name}"
      draw_options = {:human_name => false}
      draw_options[:human_name] = graph_options.delete(:human_names) if graph_options.include?(:human_names)

      graph = Graph.new(name, graph_options)

      # Add nodes / edges
      states.by_priority.each { |state| state.draw(graph, draw_options) }
      events.each { |event| event.draw(graph, self, draw_options) }

      # Output result
      graph.output
      graph
    end
def draw(graph_options = {})
      name = graph_options.delete(:name) || "#{owner_class.name}_#{self.name}"
      draw_options = {:human_name => false}
      draw_options[:human_name] = graph_options.delete(:human_names) if graph_options.include?(:human_names)

      graph = Graph.new(name, graph_options)

      # Add nodes / edges
      states.by_priority.each { |state| state.draw(graph, draw_options) }
      events.each { |event| event.draw(graph, self, draw_options) }

      # Output result
      graph.output
      graph
    end
Draws a directed graph of the machine for visualizing the various events,
 states, and their transitions.

 This requires both the Ruby graphviz gem and the graphviz library be
 installed on the system.

 Configuration options:
 * <tt>:name</tt> - The name of the file to write to (without the file extension).
   Default is "#{owner_class.name}_#{name}"
 * <tt>:path</tt> - The path to write the graph file to.  Default is the
   current directory (".").
 * <tt>:format</tt> - The image format to generate the graph in.
   Default is "png'.
 * <tt>:font</tt> - The name of the font to draw state names in.
   Default is "Arial".
 * <tt>:orientation</tt> - The direction of the graph ("portrait" or
   "landscape").  Default is "portrait".
 * <tt>:human_names</tt> - Whether to use human state / event names for
   node labels on the graph instead of the internal name.  Default is false.