Class: YARD::CLI::Graph
- Inherits:
-
YardoptsCommand
- Object
- Command
- YardoptsCommand
- YARD::CLI::Graph
- Defined in:
- lib/yard/cli/graph.rb
Overview
A command-line utility to generate Graphviz graphs from a set of objects
Constant Summary
Constants inherited from YardoptsCommand
YardoptsCommand::DEFAULT_YARDOPTS_FILE
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.
Attributes inherited from YardoptsCommand
#options_file, #use_document_file, #use_yardopts_file
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 YardoptsCommand
Methods inherited from Command
Constructor Details
#initialize ⇒ Graph
Creates a new instance of the command-line utility
34 35 36 37 38 39 40 |
# File 'lib/yard/cli/graph.rb', line 34 def initialize super @use_document_file = false @options = GraphOptions.new .reset_defaults .serializer = YARD::Serializers::StdoutSerializer.new end |
Instance Attribute Details
#objects ⇒ Object (readonly)
The set of objects to include in the graph.
31 32 33 |
# File 'lib/yard/cli/graph.rb', line 31 def objects @objects end |
#options ⇒ Object (readonly)
The options parsed out of the commandline. Default options are:
:format => :dot
28 29 30 |
# File 'lib/yard/cli/graph.rb', line 28 def @options end |
Instance Method Details
#description ⇒ Object
42 43 44 |
# File 'lib/yard/cli/graph.rb', line 42 def description "Graphs class diagram using Graphviz" end |
#run(*args) ⇒ Object
Runs the command-line utility.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/yard/cli/graph.rb', line 52 def run(*args) parse_arguments(*args) contents = objects.map do |o| o.format(.merge(:serialize => false)) end.join("\n") opts = {:type => :layout, :contents => contents} .update(opts) Templates::Engine.render() end |