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 {CodeObjects::Base}.
NSEP | = | '::' | Namespace separator | |
NSEPQ | = | NSEP | Regex-quoted namespace separator | |
ISEP | = | '#' | Instance method separator | |
ISEPQ | = | ISEP | Regex-quoted instance method separator | |
CSEP | = | '.' | Class method separator | |
CSEPQ | = | Regexp.quote CSEP | Regex-quoted class method separator | |
CONSTANTMATCH | = | /[A-Z]\w*/ | Regular expression to match constant name | |
NAMESPACEMATCH | = | /(?:(?:#{NSEPQ})?#{CONSTANTMATCH})+/ | Regular expression to match namespaces (const A or complex path A::B) | |
METHODNAMEMATCH | = | /[a-zA-Z_]\w*[!?=]?|[-+~]\@|<<|>>|=~|===?|<=>|[<>]=?|\*\*|[-\/+%^&*~`|]|\[\]=?/ | Regular expression to match a method name | |
METHODMATCH | = | /(?:(?:#{NAMESPACEMATCH}|[a-z]\w*)\s*(?:#{CSEPQ}|#{NSEPQ})\s*)?#{METHODNAMEMATCH}/ | Regular expression to match a fully qualified method def (self.foo, Class.foo). | |
BUILTIN_EXCEPTIONS | = | ["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"] | All builtin Ruby exception classes for inheritance tree. | |
BUILTIN_CLASSES | = | ["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 | All builtin Ruby classes for inheritance tree. @note MatchingData is a 1.8.x legacy class | |
BUILTIN_MODULES | = | ["ObjectSpace", "Signal", "Marshal", "Kernel", "Process", "GC", "FileTest", "Enumerable", "Comparable", "Errno", "Precision", "Math"] | All builtin Ruby modules for mixin handling. | |
BUILTIN_ALL | = | BUILTIN_CLASSES + BUILTIN_MODULES | All builtin Ruby classes and modules. | |
BUILTIN_EXCEPTIONS_HASH | = | BUILTIN_EXCEPTIONS.inject({}) {|h,n| h.update(n => true) } | Hash of {BUILTIN_EXCEPTIONS} as keys and true as value (for O(1) lookups) |