In Files

  • delegate.rb

Class/Module Index [+]

Quicksearch

Object

Public Instance Methods

!() click to toggle source

Delegates ! to the _getobj_

 
               # File delegate.rb, line 179
def !
  !__getobj__
end
            
!=(obj) click to toggle source

Returns true if two objects are not considered of equal value.

 
               # File delegate.rb, line 163
def !=(obj)
  return false if obj.equal?(self)
  __getobj__ != obj
end
            
==(obj) click to toggle source

Returns true if two objects are considered of equal value.

 
               # File delegate.rb, line 155
def ==(obj)
  return true if obj.equal?(self)
  self.__getobj__ == obj
end
            
__getobj__() click to toggle source

This method must be overridden by subclasses and should return the object method calls are being delegated to.

 
               # File delegate.rb, line 187
def __getobj__
  __raise__ ::NotImplementedError, "need to define `__getobj__'"
end
            
__setobj__(obj) click to toggle source

This method must be overridden by subclasses and change the object delegate to obj.

 
               # File delegate.rb, line 195
def __setobj__(obj)
  __raise__ ::NotImplementedError, "need to define `__setobj__'"
end
            
eql?(obj) click to toggle source

Returns true if two objects are considered of equal value.

 
               # File delegate.rb, line 171
def eql?(obj)
  return true if obj.equal?(self)
  obj.eql?(__getobj__)
end
            
freeze() click to toggle source

:method: freeze Freeze both the object returned by _getobj_ and self.

 
               # File delegate.rb, line 236
def freeze
  __getobj__.freeze
  super()
end
            
marshal_dump() click to toggle source

Serialization support for the object returned by _getobj_.

 
               # File delegate.rb, line 202
def marshal_dump
  ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
  [
    :__v2__,
    ivars, ivars.map {|var| instance_variable_get(var)},
    __getobj__
  ]
end
            
marshal_load(data) click to toggle source

Reinitializes delegation from a serialized object.

 
               # File delegate.rb, line 214
def marshal_load(data)
  version, vars, values, obj = data
  if version == :__v2__
    vars.each_with_index {|var, i| instance_variable_set(var, values[i])}
    __setobj__(obj)
  else
    __setobj__(data)
  end
end
            
methods(all=true) click to toggle source

Returns the methods available to this delegate object as the union of this object's and _getobj_ methods.

 
               # File delegate.rb, line 130
def methods(all=true)
  __getobj__.methods(all) | super
end
            
protected_methods(all=true) click to toggle source

Returns the methods available to this delegate object as the union of this object's and _getobj_ protected methods.

 
               # File delegate.rb, line 146
def protected_methods(all=true)
  __getobj__.protected_methods(all) | super
end
            
public_methods(all=true) click to toggle source

Returns the methods available to this delegate object as the union of this object's and _getobj_ public methods.

 
               # File delegate.rb, line 138
def public_methods(all=true)
  __getobj__.public_methods(all) | super
end
            
There is an updated format of the API docs for this version here.