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
Instance Attribute Summary (collapse)
-
- (Object) objects
readonly
The set of objects to include in the graph.
-
- (Object) options
readonly
The options parsed out of the commandline.
-
- (String) options_file
inherited
from YardoptsCommand
The options file name (defaults to YardoptsCommand::DEFAULT_YARDOPTS_FILE).
-
- (Boolean) use_document_file
inherited
from YardoptsCommand
Whether to parse options from .document.
-
- (Boolean) use_yardopts_file
inherited
from YardoptsCommand
Whether to parse options from .yardopts.
Instance Method Summary (collapse)
- - (Object) description
-
- (Graph) initialize
constructor
Creates a new instance of the command-line utility.
-
- (Object) run(*args)
Runs the command-line utility.
Constructor Details
- (Graph) initialize
Creates a new instance of the command-line utility
33 34 35 36 37 38 39 |
# File 'lib/yard/cli/graph.rb', line 33 def initialize super @use_document_file = false @options = GraphOptions.new .reset_defaults .serializer = YARD::Serializers::StdoutSerializer.new end |
Instance Attribute Details
- (Object) objects (readonly)
The set of objects to include in the graph.
30 31 32 |
# File 'lib/yard/cli/graph.rb', line 30 def objects @objects end |
- (Object) options (readonly)
The options parsed out of the commandline. Default options are:
:format => :dot
27 28 29 |
# File 'lib/yard/cli/graph.rb', line 27 def @options end |
- (String) options_file Originally defined in class YardoptsCommand
The options file name (defaults to DEFAULT_YARDOPTS_FILE)
- (Boolean) use_document_file Originally defined in class YardoptsCommand
Returns whether to parse options from .document
- (Boolean) use_yardopts_file Originally defined in class YardoptsCommand
Returns whether to parse options from .yardopts
Instance Method Details
- (Object) description
41 42 43 |
# File 'lib/yard/cli/graph.rb', line 41 def description "Graphs class diagram using Graphviz" end |
- (Object) run(*args)
Runs the command-line utility.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/yard/cli/graph.rb', line 51 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 |