Class: YARD::CLI::Graph
Overview
A command-line utility to generate Graphviz graphs from a set of objects
Instance Attribute Summary collapse
-
#objects ⇒ Object
readonly
The set of objects to include in the graph.
-
#options ⇒ Object
readonly
The options parsed out of the commandline.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize ⇒ Graph
constructor
Creates a new instance of the command-line utility.
-
#run(*args) ⇒ Object
Runs the command-line utility.
Methods inherited from Command
#common_options, #parse_options, run
Constructor Details
#initialize ⇒ Graph
Creates a new instance of the command-line utility
18 19 20 21 22 |
# File 'lib/yard/cli/graph.rb', line 18 def initialize super @serializer = YARD::Serializers::StdoutSerializer.new @options = SymbolHash[:format => :dot] end |
Instance Attribute Details
#objects ⇒ Object (readonly)
The set of objects to include in the graph.
15 16 17 |
# File 'lib/yard/cli/graph.rb', line 15 def objects @objects end |
#options ⇒ Object (readonly)
The options parsed out of the commandline. Default options are:
:format => :dot
12 13 14 |
# File 'lib/yard/cli/graph.rb', line 12 def @options end |
Instance Method Details
#description ⇒ Object
24 25 26 |
# File 'lib/yard/cli/graph.rb', line 24 def description "Graphs class diagram using Graphviz" end |
#run(*args) ⇒ Object
Runs the command-line utility.
34 35 36 37 38 39 40 41 42 |
# File 'lib/yard/cli/graph.rb', line 34 def run(*args) Registry.load optparse(*args) contents = objects.map {|o| o.format() }.join("\n") Templates::Engine.render(:format => :dot, :type => :layout, :verifier => @verifier, :serializer => @serializer, :contents => contents) end |