Module: YARD::CodeObjects

Extended by:
NamespaceMapper
Included in:
Handlers::Base, Handlers::C::HandlerMethods, Handlers::Ruby::DSLHandler, Handlers::Ruby::DSLHandlerMethods, Handlers::Ruby::Legacy::DSLHandler, Handlers::Ruby::StructHandlerMethods
Defined in:
lib/yard/autoload.rb,
lib/yard/code_objects/base.rb,
lib/yard/code_objects/proxy.rb,
lib/yard/code_objects/root_object.rb,
lib/yard/code_objects/class_object.rb,
lib/yard/code_objects/macro_object.rb,
lib/yard/code_objects/method_object.rb,
lib/yard/code_objects/module_object.rb,
lib/yard/code_objects/constant_object.rb,
lib/yard/code_objects/namespace_mapper.rb,
lib/yard/code_objects/namespace_object.rb,
lib/yard/code_objects/extra_file_object.rb,
lib/yard/code_objects/class_variable_object.rb,
lib/yard/code_objects/extended_method_object.rb

Overview

A “code object” is defined as any entity in the Ruby language. Classes, modules, methods, class variables and constants are the major objects, but DSL languages can create their own by inheriting from Base.

Defined Under Namespace

Modules: NamespaceMapper Classes: Base, ClassObject, ClassVariableObject, CodeObjectList, ConstantObject, ExtendedMethodObject, ExtraFileObject, MacroObject, MethodObject, ModuleObject, NamespaceObject, Proxy, ProxyMethodError, RootObject

Constant Summary collapse

NSEP =

Namespace separator

'::'
NSEPQ =

Regex-quoted namespace separator

NSEP
ISEP =

Instance method separator

'#'
ISEPQ =

Regex-quoted instance method separator

ISEP
CSEP =

Class method separator

'.'
CSEPQ =

Regex-quoted class method separator

Regexp.quote CSEP
CONSTANTMATCH =

Regular expression to match constant name

/[A-Z]\w*/
CONSTANTSTART =

Regular expression to match the beginning of a constant

/^[A-Z]/
NAMESPACEMATCH =

Regular expression to match namespaces (const A or complex path A::B)

/(?:(?:#{NSEPQ}\s*)?#{CONSTANTMATCH})+/
METHODNAMEMATCH =

Regular expression to match a method name

%r{[a-zA-Z_]\w*[!?=]?|[-+~]\@|<<|>>|=~|===?|![=~]?|<=>|[<>]=?|\*\*|[-/+%^&*~`|]|\[\]=?}
METHODMATCH =

Regular expression to match a fully qualified method def (self.foo, Class.foo).

/(?:(?:#{NAMESPACEMATCH}|[a-z]\w*)\s*(?:#{CSEPQ}|#{NSEPQ})\s*)?#{METHODNAMEMATCH}/
BUILTIN_EXCEPTIONS =

All builtin Ruby exception classes for inheritance tree.

["ArgumentError", "ClosedQueueError", "EncodingError",
"EOFError", "Exception", "FiberError", "FloatDomainError", "IndexError",
"Interrupt", "IOError", "KeyError", "LoadError", "LocalJumpError",
"NameError", "NoMemoryError", "NoMethodError", "NotImplementedError",
"RangeError", "RegexpError", "RuntimeError", "ScriptError", "SecurityError",
"SignalException", "StandardError", "StopIteration", "SyntaxError",
"SystemCallError", "SystemExit", "SystemStackError", "ThreadError",
"TypeError", "UncaughtThrowError", "ZeroDivisionError"]
BUILTIN_CLASSES =
Note:

MatchingData is a 1.8.x legacy class

All builtin Ruby classes for inheritance tree.

["Array", "Bignum", "Binding", "Class", "Complex",
"ConditionVariable", "Data", "Dir", "Encoding", "Enumerator", "FalseClass",
"Fiber", "File", "Fixnum", "Float", "Hash", "IO", "Integer", "MatchData",
"Method", "Module", "NilClass", "Numeric", "Object", "Proc", "Queue",
"Random", "Range", "Rational", "Regexp", "RubyVM", "SizedQueue", "String",
"Struct", "Symbol", "Thread", "ThreadGroup", "Time", "TracePoint",
"TrueClass", "UnboundMethod"] + BUILTIN_EXCEPTIONS
BUILTIN_MODULES =

All builtin Ruby modules for mixin handling.

["Comparable", "Enumerable", "Errno", "FileTest", "GC",
"Kernel", "Marshal", "Math", "ObjectSpace", "Precision", "Process", "Signal"]
BUILTIN_ALL =

All builtin Ruby classes and modules.

BUILTIN_CLASSES + BUILTIN_MODULES
BUILTIN_EXCEPTIONS_HASH =

Hash of BUILTIN_EXCEPTIONS as keys and true as value (for O(1) lookups)

BUILTIN_EXCEPTIONS.inject({}) {|h, n| h.update(n => true) }

Method Summary

Methods included from NamespaceMapper

clear_separators, default_separator, register_separator, separators, separators_for_type, separators_match, types_for_separator