Sha256: 6a13c600b02c42da4299005c3b5f8947d431a859b8066a00b51091e2857662bd
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
#-- # Reference # # Copyright (c) 2005 Thomas Sawyer # # Ruby License # # This module is free software. You may use, modify, and/or redistribute this # software under the same terms as Ruby. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. # # ========================================================================== # Revision History # ========================================================================== # # 2005.06.12 trans Changed name from Ref to Reference. # # ========================================================================== #++ #:title: Reference # # TODO # # == Synopsis # # a = "Hello" # b = ref(a) # b.upcase #=> "HELLO" # class Reference #instance_methods.each{|m| undef_method(m)} instance_methods.each{|m| undef_method(m) unless m == '__send__' or m == '__id__'} def self.new(obj) ref = allocate ref.become obj ref end def method_missing(*args, &block) @ref.__send__(*args, &block) end def become(obj) old = @ref @ref = obj old end def __value__ @ref end end module Kernel def ref(x) Reference.new(x) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mega-0.3.1 | lib/mega/reference.rb |