Class: YARD::CLI::YRI
Overview
A tool to view documentation in the console like ‘ri`
Constant Summary collapse
- CACHE_FILE =
The location in YARD::CONFIG_DIR where the YRI cache file is loaded from.
File.(File.join(YARD::Config::CONFIG_DIR, 'yri_cache'))
- SEARCH_PATHS_FILE =
A file containing all paths, delimited by newlines, to search for yardoc databases.
File.(File.join(YARD::Config::CONFIG_DIR, 'yri_search_paths'))
- DEFAULT_SEARCH_PATHS =
Default search paths that should be loaded dynamically into YRI. These paths take precedence over all other paths (SEARCH_PATHS_FILE and RubyGems paths). To add a path, call:
DEFAULT_SEARCH_PATHS.push("/path/to/.yardoc")
[]
Class Method Summary collapse
-
.run(*args) ⇒ Object
Helper method to run the utility on an instance.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize ⇒ YRI
constructor
A new instance of YRI.
-
#run(*args) ⇒ Object
Runs the command-line utility.
Constructor Details
#initialize ⇒ YRI
Returns a new instance of YRI.
31 32 33 34 35 36 37 38 39 |
# File 'lib/yard/cli/yri.rb', line 31 def initialize super @cache = {} @search_paths = [] add_default_paths add_gem_paths load_cache @search_paths.uniq! end |
Class Method Details
.run(*args) ⇒ Object
Helper method to run the utility on an instance.
29 |
# File 'lib/yard/cli/yri.rb', line 29 def self.run(*args) new.run(*args) end |
Instance Method Details
#description ⇒ Object
41 42 43 |
# File 'lib/yard/cli/yri.rb', line 41 def description "A tool to view documentation in the console like `ri`" end |
#run(*args) ⇒ Object
Runs the command-line utility.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/yard/cli/yri.rb', line 50 def run(*args) optparse(*args) if ::RbConfig::CONFIG['host_os'] =~ /mingw|win32/ @serializer ||= YARD::Serializers::StdoutSerializer.new else @serializer ||= YARD::Serializers::ProcessSerializer.new('less') end if @name.nil? || @name.strip.empty? print_usage return exit(1) end object = find_object(@name) if object print_object(object) else STDERR.puts "No documentation for `#{@name}'" return exit(1) end end |