Reference

Reference provides a way to access object indirectly. This allows for the object itself to be changed on the fly.

Synopsis

  a = "HELLO"
  b = ref(a)
  puts b    #=> "HELLO"
  c = 10
  b.become(c)
  puts b    #=> "10"
Methods
Public Class methods
new(obj)
# File lib/facets/more/reference.rb, line 37
  def self.new(obj)
    ref = allocate
    ref.become obj
    ref
  end
Public Instance methods
__value__()
This method is also aliased as self
# File lib/facets/more/reference.rb, line 53
  def __value__
    @ref
  end
become(obj)
# File lib/facets/more/reference.rb, line 47
  def become(obj)
    old = @ref
    @ref = obj
    old
  end
method_missing(*args, &block)
# File lib/facets/more/reference.rb, line 43
  def method_missing(*args, &block)
    @ref.__send__(*args, &block)
  end
self()

Alias for #value