Module: YARD::CodeObjects

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_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

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*/
NAMESPACEMATCH =

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

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

Regular expression to match a method name

/[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.

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

MatchingData is a 1.8.x legacy class

All builtin Ruby classes for inheritance tree.

["TrueClass", "Array", "Dir", "Struct", "UnboundMethod", "Object", "Fixnum", "Float",
"ThreadGroup", "MatchingData", "MatchData", "Proc", "Binding", "Class", "Time", "Bignum", "NilClass", "Symbol",
"Numeric", "String", "Data", "MatchData", "Regexp", "Integer", "File", "IO", "Range", "FalseClass",
"Method", "Continuation", "Thread", "Hash", "Module"] + BUILTIN_EXCEPTIONS
BUILTIN_MODULES =

All builtin Ruby modules for mixin handling.

["ObjectSpace", "Signal", "Marshal", "Kernel", "Process", "GC", "FileTest", "Enumerable",
"Comparable", "Errno", "Precision", "Math"]
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) }