Class: Ref

Inherits:
Object show all
Defined in:
lib/carat/ref.rb

Overview

Document please.

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



13
14
15
# File 'lib/carat/ref.rb', line 13

def method_missing(*args, &block)
  @ref.__send__(*args, &block)
end

Class Method Details

.new(obj) ⇒ Object



7
8
9
10
11
# File 'lib/carat/ref.rb', line 7

def self.new(obj)
  ref = allocate
  ref.become obj
  ref
end

Instance Method Details

#__value__Object



23
# File 'lib/carat/ref.rb', line 23

def __value__() @ref end

#become(obj) ⇒ Object



17
18
19
20
21
# File 'lib/carat/ref.rb', line 17

def become(obj)
  old = @ref
  @ref = obj
  old
end