This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.
# Symbol < Object --- # Includes: Comparable (from ruby core) (from ruby core) --- Symbol objects represent named identifiers inside the Ruby interpreter. You can create a Symbol object explicitly with: * A [symbol literal](doc/syntax/literals_rdoc.html#label-Symbol+Literals). The same Symbol object will be created for a given name or string for the duration of a program's execution, regardless of the context or meaning of that name. Thus if `Fred` is a constant in one context, a method in another, and a class in a third, the Symbol `:Fred` will be the same object in all three contexts. module One class Fred end $f1 = :Fred end module Two Fred = 1 $f2 = :Fred end def Fred() end $f3 = :Fred $f1.object_id #=> 2514190 $f2.object_id #=> 2514190 $f3.object_id #=> 2514190 Constant, method, and variable names are returned as symbols: module One Two = 2 def three; 3 end @four = 4 @@five = 5 $six = 6 end seven = 7 One.constants # => [:Two] One.instance_methods(true) # => [:three] One.instance_variables # => [:@four] One.class_variables # => [:@@five] global_variables.grep(/six/) # => [:$six] local_variables # => [:seven] Symbol objects are different from String objects in that Symbol objects represent identifiers, while String objects represent text or data. ## What's Here First, what's elsewhere. Class Symbol: * Inherits from [class Object](Object.html#class-Object-label-What-27s+Here). * Includes [module Comparable](Comparable.html#module-Comparable-label-What-27s+Here). Here, class Symbol provides methods that are useful for: * [Querying](#class-Symbol-label-Methods+for+Querying) * [Comparing](#class-Symbol-label-Methods+for+Comparing) * [Converting](#class-Symbol-label-Methods+for+Converting) ### Methods for Querying ::all_symbols : Returns an array of the symbols currently in Ruby's symbol table. [#=~](#method-i-3D~) : Returns the index of the first substring in symbol that matches a given Regexp or other object; returns `nil` if no match is found. #[], #slice : Returns a substring of symbol determined by a given index, start/length, or range, or string. #empty? : Returns `true` if `self.length` is zero; `false` otherwise. #encoding : Returns the Encoding object that represents the encoding of symbol. #end_with? : Returns `true` if symbol ends with any of the given strings. #match : Returns a MatchData object if symbol matches a given Regexp; `nil` otherwise. #match? : Returns `true` if symbol matches a given Regexp; `false` otherwise. #length, #size : Returns the number of characters in symbol. #start_with? : Returns `true` if symbol starts with any of the given strings. ### Methods for Comparing [#<=>](#method-i-3C-3D-3E) : Returns -1, 0, or 1 as a given symbol is smaller than, equal to, or larger than symbol. [#==, #===](#method-i-3D-3D) : Returns `true` if a given symbol has the same content and encoding. #casecmp : Ignoring case, returns -1, 0, or 1 as a given symbol is smaller than, equal to, or larger than symbol. #casecmp? : Returns `true` if symbol is equal to a given symbol after Unicode case folding; `false` otherwise. ### Methods for Converting #capitalize : Returns symbol with the first character upcased and all other characters downcased. #downcase : Returns symbol with all characters downcased. #inspect : Returns the string representation of `self` as a symbol literal. #name : Returns the frozen string corresponding to symbol. #succ, #next : Returns the symbol that is the successor to symbol. #swapcase : Returns symbol with all upcase characters downcased and all downcase characters upcased. #to_proc : Returns a Proc object which responds to the method named by symbol. #to_s, #id2name : Returns the string corresponding to `self`. #to_sym, #intern : Returns `self`. #upcase : Returns symbol with all characters upcased. --- # Class methods: all_symbols json_create # Instance methods: <=> == === =~ [] as_json capitalize casecmp casecmp? downcase empty? encoding end_with? id2name inspect intern length match match? name next size slice start_with? succ swapcase to_json to_proc to_s to_sym upcase (from gem builder-3.2.4) --- # Instance methods: _blankslate_as_name
This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.