Class: YARD::CLI::Graph
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
YardoptsCommand ,
Command
|
|
Instance Chain:
self,
YardoptsCommand ,
Command
|
|
Inherits: |
YARD::CLI::YardoptsCommand
|
Defined in: | lib/yard/cli/graph.rb |
Overview
A command-line utility to generate Graphviz graphs from a set of objects
Constant Summary
YardoptsCommand
- Inherited
Class Method Summary
-
.new ⇒ Graph
constructor
Creates a new instance of the command-line utility.
YardoptsCommand
- Inherited
.new | Creates a new command that reads .yardopts. |
Command
- Inherited
.run | Helper method to run the utility on an instance. |
Instance Attribute Summary
-
#objects
readonly
The set of objects to include in the graph.
-
#options
readonly
The options parsed out of the commandline.
YardoptsCommand
- Inherited
#options_file | The options file name (defaults to |
#use_document_file, #use_yardopts_file |
Instance Method Summary
- #description
-
#run(*args)
Runs the command-line utility.
-
#optparse(*args)
private
Parses commandline options.
- #unrecognized_option(err) private
YardoptsCommand
- Inherited
#parse_arguments | Parses commandline arguments. |
#parse_rdoc_document_file, #parse_yardopts, | |
#parse_yardopts_options | Parses out the yardopts/document options. |
#support_rdoc_document_file! | Reads a .document file in the directory to get source file globs. |
#yardopts | Parses the .yardopts file for default yard options. |
Command
- Inherited
Constructor Details
.new ⇒ Graph
Creates a new instance of the command-line utility
# 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 (readonly)
The set of objects to include in the graph.
# File 'lib/yard/cli/graph.rb', line 31
attr_reader :objects
#options (readonly)
The options parsed out of the commandline. Default options are: :format => :dot
# File 'lib/yard/cli/graph.rb', line 28
attr_reader :
Instance Method Details
#description
# File 'lib/yard/cli/graph.rb', line 42
def description "Graphs class diagram using Graphviz" end
#optparse(*args) (private)
Parses commandline options.
# File 'lib/yard/cli/graph.rb', line 69
def optparse(*args) visibilities = [:public] opts = OptionParser.new opts.separator "" opts.separator "General Options:" opts.on('-b', '--db FILE', 'Use a specified .yardoc db to load from or save to. (defaults to .yardoc)') do |yfile| YARD::Registry.yardoc_file = yfile end opts.on('--full', 'Full class diagrams (show methods and attributes).') do [:full] = true end opts.on('-d', '--dependencies', 'Show mixins in dependency graph.') do [:dependencies] = true end opts.on('--no-public', "Don't show public methods. (default shows public)") do visibilities.delete(:public) end opts.on('--protected', "Show or don't show protected methods. (default hides protected)") do visibilities.push(:protected) end opts.on('--private', "Show or don't show private methods. (default hides private)") do visibilities.push(:private) end opts.separator "" opts.separator "Output options:" opts.on('--dot [OPTIONS]', 'Send the results directly to `dot` with optional arguments.') do |dotopts| .serializer = Serializers::ProcessSerializer.new('dot ' + dotopts.to_s) end opts.on('-f', '--file [FILE]', 'Writes output to a file instead of stdout.') do |file| .serializer = Serializers::FileSystemSerializer.new(:basepath => '.', :extension => nil) .serializer.instance_eval "def serialized_path(object) #{file.inspect} end" end (opts) (opts, args) Registry.load expression = "#{visibilities.uniq.inspect}.include?(object.visibility)" .verifier = Verifier.new(expression) @objects = args.first ? args.map {|o| Registry.at(o) }.compact : [Registry.root] end
#run(*args)
Runs the command-line utility.
#unrecognized_option(err) (private)
# File 'lib/yard/cli/graph.rb', line 65
def unrecognized_option(err) end