Parent

Reference

Reference

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

  a = "HELLO"
  b = ref(a)
  puts b    #=> "HELLO"
  c = 10
  b.become(c)
  puts b    #=> "10"

Public Class Methods

new(obj) click to toggle source
    # File lib/more/facets/reference.rb, line 50
50:   def self.new(obj)
51:     ref = allocate
52:     ref.become obj
53:     ref
54:   end

Public Instance Methods

__value__() click to toggle source
    # File lib/more/facets/reference.rb, line 66
66:   def __value__
67:     @ref
68:   end
Also aliased as: instance_delegate
become(obj) click to toggle source
    # File lib/more/facets/reference.rb, line 60
60:   def become(obj)
61:     old = @ref
62:     @ref = obj
63:     old
64:   end
instance_delegate() click to toggle source
Alias for: __value__
method_missing(*args, &block) click to toggle source
    # File lib/more/facets/reference.rb, line 56
56:   def method_missing(*args, &block)
57:     @ref.__send__(*args, &block)
58:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.