| instance methods | 
| == | obj == anObject
        -> trueorfalse | 
 | Equality---At the Objectlevel,==returnstrueonly if
      obj and anObject are the same object. Typically, this
      method is overridden in descendent classes to provide
      class-specific meaning. | | === | obj === anObject
        -> trueorfalse | 
 | Case Equality---A synonym for Object#==, but typically overridden by
      descendents to provide meaningful semantics incasestatements. | | =~ | obj =~ anObject
        -> false | 
 | Pattern Match---Overridden by descendents (notably RegexpandString) to provide meaningful
      pattern-match semantics. | | __id__ | obj.__id__
        -> aFixnum | 
 | Synonym for Object#id. | | __send__ | obj.__send__(
        aSymbol [, args]+ ) -> anObject | 
 | Synonym for Object#send. | | class | obj.class -> aClass | 
 | Returns the class of obj (synonym for Object#type). | | clone | obj.clone -> anObject | 
 | Produces a shallow copy of obj---the instance variables of obj
      are copied, but not the objects they reference. 
      Copies the frozen and tainted state of obj. See also the
      discussion under Object#dup.
| class Klass |  
|    attr_accessor :str |  
| end |  
  | s1 = Klass.new | » | #<Klass:0x4018d234> |  
  | s1.str = "Hello" | » | "Hello" |  
  | s2 = s1.clone | » | #<Klass:0x4018d194  @str="Hello"> |  
  | s2.str[1,4] = "i" | » | "i" |  
  | s1.inspect | » | "#<Klass:0x4018d234  @str=\"Hi\">" |  
  | s2.inspect | » | "#<Klass:0x4018d194  @str=\"Hi\">" |  | | display | obj.display( port= $>)
        ->nil | 
 | Prints obj on the given port (default $>). Equivalent 
      to:| 
def display(port=$>)
  port.write self
end
 | 
 | | dup | obj.dup -> anObject | 
 | Produces a shallow copy      
      of obj---the instance variables of obj
      are copied, but not the objects they reference. dupcopies the tainted state of obj. See also the
      discussion underObject#clone.
      In general,cloneanddupmay have different semantics in
      descendent classes. Whilecloneis used to duplicate an 
      object, including its internal state,duptypically
      uses the class of the descendent object to create the new instance. | | eql? | obj.eql?( anObject )
        -> trueorfalse | 
 | Returns trueif obj and anObject have the
      same value. Used byHashto test
      members for equality. For objects of classObject,eql?is synonymous with==. Subclasses
      normally continue this tradition, but there are
      exceptions.Numerictypes, for example, perform type
      conversion across==, but not acrosseql?, so:
  | 1 == 1.0 | » | true |  
  | 1.eql? 1.0 | » | false |  | | equal? | obj.equal?( anObject )
        -> trueorfalse | 
 | Returns trueif obj and anObject have the
      same object ID. This method should
      not be overridden by subclasses.
| a = [ 'cat', 'dog' ] |  
| b = [ 'cat', 'dog' ] |  
  | a == b | » | true |  
  | a.id == b.id | » | false |  
  | a.eql?(b) | » | true |  
  | a.equal?(b) | » | false |  | | extend | obj.extend( [aModule]+ )
        -> obj | 
 | Adds to obj the instance methods from each module given as a parameter. 
| module Mod |  
|   def hello |  
|     "Hello from Mod.\n" |  
|   end |  
| end |  
|  |  
| class Klass |  
|   def hello |  
|     "Hello from Klass.\n" |  
|   end |  
| end |  
|  |  
| k = Klass.new |  
  | k.hello | » | "Hello from Klass.\n" |  
  | k.extend(Mod) | » | #<Klass:0x4018d414> |  
  | k.hello | » | "Hello from Mod.\n" |  | | freeze | obj.freeze -> obj | 
 | Prevents further modifications to obj. A TypeErrorwill be raised if modification is attempted. There is no way to
      unfreeze a frozen object.
      See alsoObject#frozen?.produces:| 
a = [ "a", "b", "c" ]
a.freeze
a << "z"
 | 
 | 
prog.rb:3:in `<<': can't modify frozen array (TypeError)
	from prog.rb:3
 | 
 | | frozen? | obj.frozen? 
        -> trueorfalse | 
 | Returns the freeze status of obj. 
| a = [ "a", "b", "c" ] |  
  | a.freeze | » | ["a", "b", "c"] |  
  | a.frozen? | » | true |  | | hash | obj.hash -> aFixnum | 
 | Generates a Fixnumhash value for this object. This function 
      must have the property thata.eql?(b)impliesa.hash == 
        b.hash. The hash value is used by classHash.
      Any hash value that exceeds the
      capacity of aFixnumwill be truncated before being used. | | id | obj.id -> aFixnum | 
 | Returns an integer identifier for obj. The same number will be 
      returned on all calls to idfor a given object, and no
      two active objects will share an id.Object#idis a
      different concept from the:namenotation, which returns the
      symbol id ofname. | | inspect | obj.inspect -> aString | 
 | Returns a string containing a human-readable representation of
      obj. If not overridden, uses the to_smethod to generate
      the string.
  | [ 1, 2, 3..4, 'five' ].inspect | » | "[1, 2, 3..4, \"five\"]" |  
  | Time.new.inspect | » | "Sun Mar 04 23:29:19 CST 2001" |  | | instance_eval | obj.instance_eval(aString
                                 [, file
                                         [line]] )
                                -> anObject obj.instance_eval {|  | block }
 -> anObject
 | 
 | Evaluates a string containing Ruby source code, or the given
      block, within the
      context of the receiver (obj). In order to set the context, the 
      variable selfis set to obj while the code is
      executing, giving the code access to obj's instance variables.
      In the version ofinstance_evalthat takes aString, the optional second and third parameters supply a
      filename and starting line number that are used when reporting
      compilation errors.
| class Klass |  
|   def initialize |  
|     @secret = 99 |  
|   end |  
| end |  
| k = Klass.new |  
  | k.instance_eval { @secret } | » | 99 |  | | instance_of? | obj.instance_of?( aClass ) 
        -> trueorfalse | 
 | Returns trueif obj is an instance of the 
      given class. See alsoObject#kind_of?. | | instance_variables | obj.instance_variables
        -> anArray | 
 | Returns an array of instance variable names for the
      receiver. | | is_a? | obj.is_a?( aClass ) 
        -> trueorfalse | 
 | Synonym for Object#kind_of?. | | kind_of? | obj.kind_of?( aClass ) 
        -> trueorfalse | 
 | Returns trueif aClass is the class of obj, or 
      if aClass is one of the superclasses of obj or modules included
      in obj.
| a = Integer.new |  
  | a.instance_of? Numeric | » | false |  
  | a.instance_of? Integer | » | true |  
  | a.instance_of? Fixnum | » | false |  
  | a.instance_of? Comparable | » | false |  
  | a.kind_of? Numeric | » | true |  
  | a.kind_of? Integer | » | true |  
  | a.kind_of? Fixnum | » | false |  
  | a.kind_of? Comparable | » | true |  | | method | obj.method( aSymbol )
        -> aMethod | 
 | Looks up the named method as a receiver in obj, returning a Methodobject (or raisingNameError). TheMethodobject acts
      as a closure in obj's object instance, so instance variables
      and the value ofselfremain available.
| class Demo |  
|   def initialize(n) |  
|     @iv = n |  
|   end |  
|   def hello() |  
|     "Hello, @iv = #{@iv}" |  
|   end |  
| end |  
|  |  
| k = Demo.new(99) |  
| m = k.method(:hello) |  
  | m.call | » | "Hello, @iv = 99" |  
|  |  
| l = Demo.new('Fred') |  
| m = l.method("hello") |  
  | m.call | » | "Hello, @iv = Fred" |  | | method_missing | obj.method_missing( aSymbol [, *args] )
        -> anObject | 
 | Invoked by Ruby when obj is sent a message it cannot
      handle. aSymbol is the symbol for the method called,
      and args are any arguments that were passed to it. The
      example below creates a class Roman, which responds to methods
      with names consisting of roman numerals, returning the corresponding
      integer values.| 
class Roman
  def romanToInt(str)
    # ...
  end
  def method_missing(methId)
    str = methId.id2name
    romanToInt(str)
  end
end
 | 
 
| r = Roman.new |  
  | r.iv | » | 4 |  
  | r.xxiii | » | 23 |  
  | r.mm | » | 2000 |  | | methods | obj.methods -> anArray | 
 | Returns a list of the names of methods publicly accessible in
      obj. This will include all the methods accessible in obj's
      ancestors. 
| class Klass |  
|   def kMethod() |  
|   end |  
| end |  
| k = Klass.new |  
  | k.methods[0..9] | » | ["kMethod", "instance_of?", "protected_methods", "inspect", "freeze", "dup", "__id__", "equal?", "send", "=="] |  
  | k.methods.length | » | 38 |  | | nil? | obj.nil? -> trueorfalse | 
 | All objects except nilreturnfalse. | | private_methods | obj.private_methods
        -> anArray | 
 | Returns a list of private methods accessible within obj. This
      will include the private methods in obj's ancestors, along
      with any mixed-in module functions. | | protected_methods | obj.protected_methods
        -> anArray | 
 | Returns the list of protected methods accessible to obj. | | public_methods | obj.public_methods -> anArray | 
 | Synonym for Object#methods. | | respond_to? | obj.respond_to?( aSymbol,
                            includePriv= false)
            ->trueorfalse | 
 | Returns trueif obj responds to the given
      method. Private methods are included in the search only if the
      optional second parameter evaluates totrue. | | send | obj.send( aSymbol
        [, args]* ) -> anObject | 
 | Invokes the method identified by aSymbol, passing it any
      arguments specified. You can use __send__if the
      namesendclashes with an existing method in obj.
| class Klass |  
|   def hello(*args) |  
|     "Hello " + args.join(' ') |  
|   end |  
| end |  
| k = Klass.new |  
  | k.send :hello, "gentle", "readers" | » | "Hello gentle readers" |  | | singleton_methods | obj.singleton_methods
        -> anArray | 
 | Returns an array of the names of singleton methods for obj. 
| class Klass |  
|   def Klass.classMethod |  
|   end |  
| end |  
| k = Klass.new |  
| def k.sm() |  
| end |  
  | Klass.singleton_methods | » | ["classMethod"] |  
  | k.singleton_methods | » | ["sm"] |  | | taint | obj.taint -> obj | 
 | Marks obj as tainted      
      (see Chapter 20, which begins on page 257). | | tainted? | obj.tainted? -> trueorfalse | 
 | Returns trueif the object is tainted. | | to_a | obj.to_a -> anArray | 
 | Returns an array representation of obj. For
      objects of class Objectand others that don't explicitly
      override the method, the return value is an array containingself.
  | self.to_a | » | [main] |  
  | "hello".to_a | » | ["hello"] |  
  | Time.new.to_a | » | [19, 29, 23, 4, 3, 2001, 0, 63, false, "CST"] |  | | to_s | obj.to_s -> aString | 
 | Returns a string representing obj. The default to_sprints the object's class and an encoding of the object id. As a
      special case, the top-level object that is the initial execution 
      context of Ruby programs returns ``main.'' | | type | obj.type -> aClass | 
 | Returns the class of obj. | | untaint | obj.untaint -> obj | 
 | Removes the taint from obj. |