Class: YARD::CLI::Display
- Inherits:
-
Yardoc
- Object
- Command
- YardoptsCommand
- Yardoc
- YARD::CLI::Display
- Defined in:
- lib/yard/cli/display.rb
Overview
Display one object
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*args) ⇒ Display
constructor
A new instance of Display.
-
#parse_arguments(*args) ⇒ Object
Parses commandline options.
-
#run(*args) ⇒ void
Runs the commandline utility, parsing arguments and displaying an object from the Registry.
Constructor Details
#initialize(*args) ⇒ Display
Returns a new instance of Display.
8 9 10 11 |
# File 'lib/yard/cli/display.rb', line 8 def initialize(*args) super .format = :text # default for this command end |
Instance Method Details
#description ⇒ Object
6 |
# File 'lib/yard/cli/display.rb', line 6 def description; 'Displays a formatted object' end |
#parse_arguments(*args) ⇒ Object
Parses commandline options.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yard/cli/display.rb', line 27 def parse_arguments(*args) opts = OptionParser.new opts. = "Usage: yard display [options] OBJECT [OTHER OBJECTS]" (opts) (opts) (opts, args) Registry.load @objects = args.map {|o| Registry.at(o) } # validation return false if @objects.any? {|o| o.nil? } end |
#run(*args) ⇒ void
This method returns an undefined value.
Runs the commandline utility, parsing arguments and displaying an object from the Registry.
18 19 20 21 22 23 |
# File 'lib/yard/cli/display.rb', line 18 def run(*args) return unless parse_arguments(*args) @objects.each do |obj| log.puts obj.format() end end |