In Files

  • delegate.rb

Class/Module Index [+]

Quicksearch

Object

Public Instance Methods

!() click to toggle source

Delegates ! to the _getobj_

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

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

 
               # File delegate.rb, line 160
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 152
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 184
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 192
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 168
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 233
def freeze
  __getobj__.freeze
  super()
end
            
marshal_dump() click to toggle source

Serialization support for the object returned by _getobj_.

 
               # File delegate.rb, line 199
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 211
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 127
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 143
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 135
def public_methods(all=true)
  __getobj__.public_methods(all) | super
end