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
-
#objects ⇒ Object
readonly
The set of objects to include in the graph.
-
#options ⇒ Object
readonly
The options parsed out of the commandline.
-
#options_file ⇒ String
inherited
from YardoptsCommand
The options file name (defaults to YardoptsCommand::DEFAULT_YARDOPTS_FILE).
-
#use_document_file ⇒ Boolean
inherited
from YardoptsCommand
Whether to parse options from .document.
-
#use_yardopts_file ⇒ Boolean
inherited
from YardoptsCommand
Whether to parse options from .yardopts.
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.
Constructor Details
#initialize ⇒ Graph
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
#objects ⇒ Object (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 |
#options ⇒ Object (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 |
#options_file ⇒ String Originally defined in class YardoptsCommand
The options file name (defaults to DEFAULT_YARDOPTS_FILE)
#use_document_file ⇒ Boolean Originally defined in class YardoptsCommand
Returns whether to parse options from .document
#use_yardopts_file ⇒ Boolean Originally defined in class YardoptsCommand
Returns whether to parse options from .yardopts
Instance Method Details
#description ⇒ Object
41 42 43 |
# File 'lib/yard/cli/graph.rb', line 41 def description "Graphs class diagram using Graphviz" end |
#run(*args) ⇒ Object
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 |