Module: YARD::Registry

### Home Classes Methods

### In Files

- lib/yard/registry.rb

### Methods

- ::[]
- ::all
- ::at
- ::checksum_for
- ::checksums
- ::clear
- ::delete
- ::delete_from_disk
- ::each
- ::instance
- ::load
- ::load!
- ::load_all
- ::load_yardoc
- ::locale
- ::paths
- ::po_dir=
- ::proxy_types
- ::register
- ::resolve
- ::root
- ::save
- ::single_object_db=
- ::yardoc_file=
- ::yardoc_file_for_gem

### Files

- LICENSE.txt
- MIT.txt

### Class/Module Index

Quicksearch

- YARD
- YARD::CLI
- YARD::CLI::Command
- YARD::CLI::CommandParser
- YARD::CLI::Config
- YARD::CLI::Diff
- YARD::CLI::Display
- YARD::CLI::Gems
- YARD::CLI::Graph
- YARD::CLI::GraphOptions
- YARD::CLI::Help
- YARD::CLI::I18n
- YARD::CLI::List
- YARD::CLI::MarkupTypes
- YARD::CLI::Server
- YARD::CLI::Stats
- YARD::CLI::YRI
- YARD::CLI::Yardoc
- YARD::CLI::YardocOptions
- YARD::CLI::YardoptsCommand
- YARD::CodeObjects
- YARD::CodeObjects::Base
- YARD::CodeObjects::ClassObject
- YARD::CodeObjects::ClassVariableObject
- YARD::CodeObjects::CodeObjectList
- YARD::CodeObjects::ConstantObject
- YARD::CodeObjects::ExtendedMethodObject
- YARD::CodeObjects::ExtraFileObject
- YARD::CodeObjects::MacroObject
- YARD::CodeObjects::MethodObject
- YARD::CodeObjects::ModuleObject
- YARD::CodeObjects::NamespaceObject
- YARD::CodeObjects::Proxy
- YARD::CodeObjects::ProxyMethodError
- YARD::CodeObjects::RootObject
- YARD::Config
- YARD::Docstring
- YARD::DocstringParser
- YARD::Handlers
- YARD::Handlers::Base
- YARD::Handlers::C
- YARD::Handlers::C::AliasHandler
- YARD::Handlers::C::AttributeHandler
- YARD::Handlers::C::Base
- YARD::Handlers::C::ClassHandler
- YARD::Handlers::C::ConstantHandler
- YARD::Handlers::C::HandlerMethods
- YARD::Handlers::C::InitHandler
- YARD::Handlers::C::MethodHandler
- YARD::Handlers::C::MixinHandler
- YARD::Handlers::C::ModuleHandler
- YARD::Handlers::C::OverrideCommentHandler
- YARD::Handlers::C::PathHandler
- YARD::Handlers::C::StructHandler
- YARD::Handlers::C::SymbolHandler
- YARD::Handlers::HandlerAborted
- YARD::Handlers::NamespaceMissingError
- YARD::Handlers::Processor
- YARD::Handlers::Ruby
- YARD::Handlers::Ruby::AliasHandler
- YARD::Handlers::Ruby::AttributeHandler
- YARD::Handlers::Ruby::Base
- YARD::Handlers::Ruby::ClassConditionHandler
- YARD::Handlers::Ruby::ClassHandler
- YARD::Handlers::Ruby::ClassVariableHandler
- YARD::Handlers::Ruby::CommentHandler
- YARD::Handlers::Ruby::ConstantHandler
- YARD::Handlers::Ruby::DSLHandler
- YARD::Handlers::Ruby::DSLHandlerMethods
- YARD::Handlers::Ruby::ExceptionHandler
- YARD::Handlers::Ruby::ExtendHandler
- YARD::Handlers::Ruby::HandlesExtension
- YARD::Handlers::Ruby::Legacy
- YARD::Handlers::Ruby::Legacy::AliasHandler
- YARD::Handlers::Ruby::Legacy::AttributeHandler
- YARD::Handlers::Ruby::Legacy::Base
- YARD::Handlers::Ruby::Legacy::ClassConditionHandler
- YARD::Handlers::Ruby::Legacy::ClassHandler
- YARD::Handlers::Ruby::Legacy::ClassVariableHandler
- YARD::Handlers::Ruby::Legacy::CommentHandler
- YARD::Handlers::Ruby::Legacy::ConstantHandler
- YARD::Handlers::Ruby::Legacy::DSLHandler
- YARD::Handlers::Ruby::Legacy::ExceptionHandler
- YARD::Handlers::Ruby::Legacy::ExtendHandler
- YARD::Handlers::Ruby::Legacy::MethodHandler
- YARD::Handlers::Ruby::Legacy::MixinHandler
- YARD::Handlers::Ruby::Legacy::ModuleFunctionHandler
- YARD::Handlers::Ruby::Legacy::ModuleHandler
- YARD::Handlers::Ruby::Legacy::PrivateClassMethodHandler
- YARD::Handlers::Ruby::Legacy::PrivateConstantHandler
- YARD::Handlers::Ruby::Legacy::VisibilityHandler
- YARD::Handlers::Ruby::Legacy::YieldHandler
- YARD::Handlers::Ruby::MethodCallWrapper
- YARD::Handlers::Ruby::MethodConditionHandler
- YARD::Handlers::Ruby::MethodHandler
- YARD::Handlers::Ruby::MixinHandler
- YARD::Handlers::Ruby::ModuleFunctionHandler
- YARD::Handlers::Ruby::ModuleHandler
- YARD::Handlers::Ruby::PrivateClassMethodHandler
- YARD::Handlers::Ruby::PrivateConstantHandler
- YARD::Handlers::Ruby::StructHandlerMethods
- YARD::Handlers::Ruby::TestNodeWrapper
- YARD::Handlers::Ruby::VisibilityHandler
- YARD::Handlers::Ruby::YieldHandler
- YARD::I18n
- YARD::I18n::Locale
- YARD::I18n::Message
- YARD::I18n::Messages
- YARD::I18n::POParser
- YARD::I18n::PotGenerator
- YARD::I18n::Text
- YARD::Logger
- YARD::Options
- YARD::Parser
- YARD::Parser::Base
- YARD::Parser::C
- YARD::Parser::C::BodyStatement
- YARD::Parser::C::CParser
- YARD::Parser::C::Comment
- YARD::Parser::C::CommentParser
- YARD::Parser::C::Statement
- YARD::Parser::C::ToplevelStatement
- YARD::Parser::OrderedParser
- YARD::Parser::ParserSyntaxError
- YARD::Parser::Ruby
- YARD::Parser::Ruby::AstNode
- YARD::Parser::Ruby::ClassNode
- YARD::Parser::Ruby::CommentNode
- YARD::Parser::Ruby::ConditionalNode
- YARD::Parser::Ruby::KeywordNode
- YARD::Parser::Ruby::Legacy
- YARD::Parser::Ruby::Legacy::RubyLex
- YARD::Parser::Ruby::Legacy::RubyLex::BufferedReader
- YARD::Parser::Ruby::Legacy::RubyParser
- YARD::Parser::Ruby::Legacy::RubyToken
- YARD::Parser::Ruby::Legacy::RubyToken::TkBlockContents
- YARD::Parser::Ruby::Legacy::RubyToken::TkError
- YARD::Parser::Ruby::Legacy::RubyToken::TkId
- YARD::Parser::Ruby::Legacy::RubyToken::TkKW
- YARD::Parser::Ruby::Legacy::RubyToken::TkNode
- YARD::Parser::Ruby::Legacy::RubyToken::TkOPASGN
- YARD::Parser::Ruby::Legacy::RubyToken::TkOp
- YARD::Parser::Ruby::Legacy::RubyToken::TkStatementEnd
- YARD::Parser::Ruby::Legacy::RubyToken::TkUnknownChar
- YARD::Parser::Ruby::Legacy::RubyToken::TkVal
- YARD::Parser::Ruby::Legacy::RubyToken::TkWhitespace
- YARD::Parser::Ruby::Legacy::RubyToken::Token
- YARD::Parser::Ruby::Legacy::Statement
- YARD::Parser::Ruby::Legacy::StatementList
- YARD::Parser::Ruby::Legacy::TokenList
- YARD::Parser::Ruby::LiteralNode
- YARD::Parser::Ruby::LoopNode
- YARD::Parser::Ruby::MethodCallNode
- YARD::Parser::Ruby::MethodDefinitionNode
- YARD::Parser::Ruby::ModuleNode
- YARD::Parser::Ruby::ParameterNode
- YARD::Parser::Ruby::ReferenceNode
- YARD::Parser::Ruby::RipperParser
- YARD::Parser::Ruby::RubyParser
- YARD::Parser::SourceParser
- YARD::Parser::UndocumentableError
- YARD::Rake
- YARD::Rake::YardocTask
- YARD::Registry
- YARD::RegistryStore
- YARD::Serializers
- YARD::Serializers::Base
- YARD::Serializers::FileSystemSerializer
- YARD::Serializers::ProcessSerializer
- YARD::Serializers::StdoutSerializer
- YARD::Serializers::YardocSerializer
- YARD::Server
- YARD::Server::Adapter
- YARD::Server::Commands
- YARD::Server::Commands::Base
- YARD::Server::Commands::DisplayFileCommand
- YARD::Server::Commands::DisplayObjectCommand
- YARD::Server::Commands::FramesCommand
- YARD::Server::Commands::LibraryCommand
- YARD::Server::Commands::LibraryIndexCommand
- YARD::Server::Commands::LibraryOptions
- YARD::Server::Commands::ListCommand
- YARD::Server::Commands::SearchCommand
- YARD::Server::Commands::StaticFileCommand
- YARD::Server::DocServerHelper
- YARD::Server::DocServerSerializer
- YARD::Server::FinishRequest
- YARD::Server::LibraryNotPreparedError
- YARD::Server::LibraryVersion
- YARD::Server::NotFoundError
- YARD::Server::RackAdapter
- YARD::Server::RackMiddleware
- YARD::Server::Router
- YARD::Server::StaticCaching
- YARD::Server::WebrickAdapter
- YARD::Server::WebrickServlet
- YARD::StubProxy
- YARD::Tags
- YARD::Tags::AttributeDirective
- YARD::Tags::DefaultFactory
- YARD::Tags::DefaultTag
- YARD::Tags::Directive
- YARD::Tags::EndGroupDirective
- YARD::Tags::GroupDirective
- YARD::Tags::Library
- YARD::Tags::MacroDirective
- YARD::Tags::MethodDirective
- YARD::Tags::OptionTag
- YARD::Tags::OverloadTag
- YARD::Tags::ParseDirective
- YARD::Tags::RefTag
- YARD::Tags::RefTagList
- YARD::Tags::ScopeDirective
- YARD::Tags::Tag
- YARD::Tags::TagFormatError
- YARD::Tags::VisibilityDirective
- YARD::Templates
- YARD::Templates::Engine
- YARD::Templates::ErbCache
- YARD::Templates::Helpers
- YARD::Templates::Helpers::BaseHelper
- YARD::Templates::Helpers::FilterHelper
- YARD::Templates::Helpers::HtmlHelper
- YARD::Templates::Helpers::HtmlSyntaxHighlightHelper
- YARD::Templates::Helpers::Markup
- YARD::Templates::Helpers::Markup::RDocMarkdown
- YARD::Templates::Helpers::Markup::RDocMarkup
- YARD::Templates::Helpers::Markup::RDocMarkup::RDocMarkup
- YARD::Templates::Helpers::Markup::RDocMarkup::RDocMarkup::RDocMarkupToHtml
- YARD::Templates::Helpers::Markup::RDocMarkup::RDocMarkupToHtml
- YARD::Templates::Helpers::MarkupHelper
- YARD::Templates::Helpers::MethodHelper
- YARD::Templates::Helpers::ModuleHelper
- YARD::Templates::Helpers::TextHelper
- YARD::Templates::Helpers::UMLHelper
- YARD::Templates::Section
- YARD::Templates::Template
- YARD::Templates::Template::ClassMethods
- YARD::Templates::TemplateOptions
- YARD::Verifier
- Gem
- Gem::DocManager
- Gem::SourceIndex
- Gem::Specification
- Rack
- Rack::Request
- WEBrick
- WEBrick::HTTPRequest
- Array
- File
- Hash
- Insertion
- Module
- Object
- String
- SymbolHash

No matching classes.

# YARD::Registry

The `Registry` is the centralized data store for all {CodeObjects} created during parsing. The storage is a key value store with the object's path (see {CodeObjects::Base#path}) as the key and the object itself as the value. Object paths must be unique to be stored in the Registry. All lookups for objects are done on the singleton Registry instance using the {Registry.at} or {Registry.resolve} methods.

## Saving / Loading a Registry

The registry is saved to a "yardoc file" (actually a directory), which can be loaded back to perform any lookups. See {Registry.load!} and {Registry.save} for information on saving and loading of a yardoc file.

## Threading Notes

The registry class is a singleton class that is accessed directly in many places across YARD. To mitigate threading issues, YARD (0.6.5+) makes the Registry thread local. This means all access to a registry for a specific object set must occur in the originating thread.

@example Loading the Registry

    Registry.load!('/path/to/yardocfile') # loads all objects into memory
    Registry.at('YARD::CodeObjects::Base').docstring
    # => "+Base+ is the superclass of all code objects ..."

@example Getting an object by a specific path

    Registry.at('YARD::CodeObjects::Base#docstring')

@example Performing a lookup on a method anywhere in the inheritance tree

    Registry.resolve(P('YARD::CodeObjects::Base'), '#docstring', true)

### Constants

DEFAULT_PO_DIR
DEFAULT_YARDOC_FILE
LOCAL_YARDOC_INDEX

### Attributes

po_dir[RW]

Gets/sets the directory that has LANG.po files @return [String] the directory that has .po files

single_object_db[RW]

Whether or not the Registry storage should load everything into a single object database (for disk efficiency), or spread them out (for load time efficiency).

@note Setting this attribute to nil will offload the decision to

    the {RegistryStore storage adapter}.

@return [Boolean, nil] if this value is set to nil, the storage

    adapter will decide how to store the data.

yardoc_file[RW]

Gets/sets the yardoc filename @return [String] the yardoc filename @see DEFAULT_YARDOC_FILE

### Public Class Methods

[](path) click to toggle source
Alias for: at
all(*types) click to toggle source

Returns all objects in the registry that match one of the types provided in the `types` list (if `types` is provided).

@example Returns all objects

    Registry.all

@example Returns all classes and modules

    Registry.all(:class, :module)

@param [Array<Symbol>] types an optional list of types to narrow the

    objects down by. Equivalent to performing a select:
      +Registry.all.select {|o| types.include(o.type) }+

@return [Array<CodeObjects::Base>] the list of objects found @see CodeObjects::Base#type

    # File lib/yard/registry.rb, line 212
    def all(*types)
      if types.empty?
        thread_local_store.values.select {|obj| obj != root }
      else
        list = []
        types.each do |type|
          list += thread_local_store.values_for_type(type)
        end
        list
      end
    end

at(path) click to toggle source

Returns the object at a specific path. @param [String, :root] path the pathname to look for. If `path` is `root`,

    returns the {root} object.

@return [CodeObjects::Base] the object at path @return [nil] if no object is found

    # File lib/yard/registry.rb, line 236
    def at(path) path ? thread_local_store[path] : nil end

Also aliased as: []
checksum_for(data) click to toggle source

@param [String] data data to checksum @return [String] the SHA1 checksum for data

    # File lib/yard/registry.rb, line 331
    def checksum_for(data)
      Digest::SHA1.hexdigest(data)
    end

checksums() click to toggle source

@return [Hash{String => String}] a set of checksums for files

    # File lib/yard/registry.rb, line 325
    def checksums
      thread_local_store.checksums
    end

clear() click to toggle source

Clears the registry @return [void]

    # File lib/yard/registry.rb, line 189
    def clear
      self.thread_local_store = RegistryStore.new
    end

delete(object) click to toggle source

Deletes an object from the registry @param [CodeObjects::Base] object the object to remove @return [void]

    # File lib/yard/registry.rb, line 183
    def delete(object)
      thread_local_store.delete(object.path)
    end

delete_from_disk() click to toggle source

Deletes the yardoc file from disk @return [void]

    # File lib/yard/registry.rb, line 165
    def delete_from_disk
      thread_local_store.destroy
    end

each(&block) click to toggle source

Iterates over {all} with no arguments

    # File lib/yard/registry.rb, line 196
    def each(&block)
      all.each(&block)
    end

instance() click to toggle source

The registry singleton instance.

@deprecated use Registry.methodname directly. @return [Registry] returns the registry instance

    # File lib/yard/registry.rb, line 375
    def instance; self end

load(files = [], reparse = false) click to toggle source

Loads the registry and/or parses a list of files

@example Loads the yardoc file or parses files 'a', 'b' and 'c' (but not both)

    Registry.load(['a', 'b', 'c'])

@example Reparses files 'a' and 'b' regardless of whether yardoc file exists

    Registry.load(['a', 'b'], true)

@param [String, Array] files if `files` is an Array, it should represent

    a list of files that YARD should parse into the registry. If reload is
    set to false and the yardoc file already exists, these files are skipped.
    If files is a String, it should represent the yardoc file to load
    into the registry.

@param [Boolean] reparse if reparse is false and a yardoc file already

    exists, any files passed in will be ignored.

@return [Registry] the registry object (for chaining) @raise [ArgumentError] if files is not a String or Array

    # File lib/yard/registry.rb, line 98
    def load(files = [], reparse = false)
      if files.is_a?(Array)
        if File.exist?(yardoc_file) && !reparse
          load_yardoc
        else
          size = thread_local_store.keys.size
          YARD.parse(files)
          save if thread_local_store.keys.size > size
        end
      elsif files.is_a?(String)
        load_yardoc(files)
      else
        raise ArgumentError, "Must take a list of files to parse or the .yardoc file to load."
      end
      self
    end

load!(file = yardoc_file) click to toggle source

Loads a yardoc file and forces all objects cached on disk into memory. Equivalent to calling {load_yardoc} followed by {load_all}

@param [String] file the yardoc file to load @return [Registry] the registry object (for chaining) @see load_yardoc @see load_all @since 0.5.1

    # File lib/yard/registry.rb, line 133
    def load!(file = yardoc_file)
      clear
      thread_local_store.load!(file)
      self
    end

load_all() click to toggle source

Forces all objects cached on disk into memory

@example Loads all objects from disk

    Registry.load
    Registry.all.count #=> 0
    Registry.load_all
    Registry.all.count #=> 17

@return [Registry] the registry object (for chaining) @since 0.5.1

    # File lib/yard/registry.rb, line 148
    def load_all
      thread_local_store.load_all
      self
    end

load_yardoc(file = yardoc_file) click to toggle source

Loads a yardoc file directly

@param [String] file the yardoc file to load. @return [Registry] the registry object (for chaining)

    # File lib/yard/registry.rb, line 119
    def load_yardoc(file = yardoc_file)
      clear
      thread_local_store.load(file)
      self
    end

locale(name) click to toggle source

@param [String] name the locale name. @return [I18n::Locale] the locale object for `name`. @since 0.8.3

    # File lib/yard/registry.rb, line 246
    def locale(name)
      thread_local_store.locale(name)
    end

paths(reload = false) click to toggle source

Returns the paths of all of the objects in the registry. @param [Boolean] reload whether to load entire database @return [Array<String>] all of the paths in the registry.

    # File lib/yard/registry.rb, line 227
    def paths(reload = false)
      thread_local_store.keys(reload).map {|k| k.to_s }
    end

po_dir=(dir) click to toggle source

    # File lib/yard/registry.rb, line 364
    def po_dir=(dir) Thread.current[:__yard_po_dir__] = dir end

proxy_types() click to toggle source

The assumed types of a list of paths. This method is used by CodeObjects::Base @return [{String => Symbol}] a set of unresolved paths and their assumed type @private @deprecated The registry no longer globally tracks proxy types.

    # File lib/yard/registry.rb, line 354
    def proxy_types
      thread_local_store.proxy_types
    end

register(object) click to toggle source

Registers a new object with the registry

@param [CodeObjects::Base] object the object to register @return [CodeObjects::Base] the registered object

    # File lib/yard/registry.rb, line 175
    def register(object)
      return if object.is_a?(CodeObjects::Proxy)
      thread_local_store[object.path] = object
    end

resolve(namespace, name, inheritance = false, proxy_fallback = false, type = nil) click to toggle source

Attempts to find an object by name starting at `namespace`, performing a lookup similar to Ruby's method of resolving a constant in a namespace.

@example Looks for instance method reverse starting from A::B::C

    Registry.resolve(P("A::B::C"), "#reverse")

@example Looks for a constant in the root namespace

    Registry.resolve(nil, 'CONSTANT')

@example Looks for a class method respecting the inheritance tree

    Registry.resolve(myclass, 'mymethod', true)

@example Looks for a constant but returns a proxy if not found

    Registry.resolve(P('A::B::C'), 'D', false, true) # => #<yardoc proxy A::B::C::D>

@example Looks for a complex path from a namespace

    Registry.resolve(P('A::B'), 'B::D') # => #<yardoc class A::B::D>

@param [CodeObjects::NamespaceObject, nil] namespace the starting namespace

    (module or class). If +nil+ or +:root+, starts from the {root} object.

@param [String, Symbol] name the name (or complex path) to look for from

    +namespace+.

@param [Boolean] inheritance Follows inheritance chain (mixins, superclass)

    when performing name resolution if set to +true+.

@param [Boolean] proxy_fallback If `true`, returns a proxy representing

    the unresolved path (namespace + name) if no object is found.

@param [Symbol, nil] type the {CodeObjects::Base#type} that the resolved

    object must be equal to. No type checking if nil.

@return [CodeObjects::Base] the object if it is found @return [CodeObjects::Proxy] a Proxy representing the object if

    +proxy_fallback+ is +true+.

@return [nil] if `proxy_fallback` is `false` and no object was found. @see P

    # File lib/yard/registry.rb, line 278
    def resolve(namespace, name, inheritance = false, proxy_fallback = false, type = nil)
      if namespace.is_a?(CodeObjects::Proxy)
        return proxy_fallback ? CodeObjects::Proxy.new(namespace, name, type) : nil
      end

      if namespace == :root || !namespace
        namespace = root
      else
        namespace = namespace.parent until namespace.is_a?(CodeObjects::NamespaceObject)
      end
      orignamespace = namespace

      name = name.to_s
      if name =~ /^#{CodeObjects::NSEPQ}/
        [name, name[2..-1]].each do |n|
          found = at(n)
          return found if found && (type.nil? || found.type == type)
        end
      else
        while namespace
          if namespace.is_a?(CodeObjects::NamespaceObject)
            if inheritance
              nss = namespace.inheritance_tree(true)
              if namespace.respond_to?(:superclass)
                if namespace.superclass != P('BasicObject')
                  nss |= [P('Object')]
                end
                nss |= [P('BasicObject')]
              end
            else
              nss = [namespace]
            end
            nss.each do |ns|
              next if ns.is_a?(CodeObjects::Proxy)
              found = partial_resolve(ns, name, type)
              return found if found
            end
          end
          namespace = namespace.parent
        end
      end
      proxy_fallback ? CodeObjects::Proxy.new(orignamespace, name, type) : nil
    end

root() click to toggle source

The root namespace object. @return [CodeObjects::RootObject] the root object in the namespace

    # File lib/yard/registry.rb, line 241
    def root; thread_local_store[:root] end

save(merge = false, file = yardoc_file) click to toggle source

Saves the registry to `file`

@param [String] file the yardoc file to save to @return [Boolean] true if the file was saved

    # File lib/yard/registry.rb, line 159
    def save(merge = false, file = yardoc_file)
      thread_local_store.save(merge, file)
    end

single_object_db=(v) click to toggle source

    # File lib/yard/registry.rb, line 347
    def single_object_db=(v) Thread.current[:__yard_single_db__] = v end

yardoc_file=(v) click to toggle source

    # File lib/yard/registry.rb, line 76
    def yardoc_file=(v) Thread.current[:__yard_yardoc_file__] = v end

yardoc_file_for_gem(gem, ver_require = ">= 0", for_writing = false) click to toggle source

Returns the .yardoc file associated with a gem.

@param [String] gem the name of the gem to search for @param [String] ver_require an optional Gem version requirement @param [Boolean] for_writing whether or not the method should search

    for writable locations

@return [String] if `for_writing` is set to `true`, returns the best

    location suitable to write the .yardoc file. Otherwise, the first
    existing location associated with the gem's .yardoc file.

@return [nil] if `for_writing` is set to false and no yardoc file

    is found, returns nil.

    # File lib/yard/registry.rb, line 52
    def yardoc_file_for_gem(gem, ver_require = ">= 0", for_writing = false)
      spec = Gem.source_index.find_name(gem, ver_require)
      return if spec.empty?
      spec = spec.first

      if gem =~ /^yard-doc-/
        path = File.join(spec.full_gem_path, DEFAULT_YARDOC_FILE)
        return File.exist?(path) && !for_writing ? path : nil
      end

      if for_writing
        global_yardoc_file(spec, for_writing) ||
          local_yardoc_file(spec, for_writing)
      else
        local_yardoc_file(spec, for_writing) ||
          global_yardoc_file(spec, for_writing)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.