diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/delegate.rb | 16 | ||||
-rw-r--r-- | lib/singleton.rb | 24 | ||||
-rw-r--r-- | version.h | 6 |
4 files changed, 29 insertions, 23 deletions
@@ -1,3 +1,9 @@ +Thu Feb 15 01:43:45 2007 Koichi Sasada <ko1@atdot.net> + + * lib/delegate.rb: catch up with class local variable (@_v) spec. + + * lib/singleton.rb: ditto. + Wed Feb 14 22:52:43 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp> * ext/win32ole/win32ole.c (ole_variant2val): VC++6 does not diff --git a/lib/delegate.rb b/lib/delegate.rb index 8574bc39ec..b5ebaa15da 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -95,15 +95,15 @@ # class SimpleDelegator < Delegator # def initialize(obj) # super # pass obj to Delegator constructor, required -# @_sd_obj = obj # store obj for future use +# @delegate_sd_obj = obj # store obj for future use # end # # def __getobj__ -# @_sd_obj # return object we are delegating to, required +# @delegate_sd_obj # return object we are delegating to, required # end # # def __setobj__(obj) -# @_sd_obj = obj # change delegation object, a feature we're providing +# @delegate_sd_obj = obj # change delegation object, a feature we're providing # end # # # ... @@ -219,7 +219,7 @@ end class SimpleDelegator<Delegator # Returns the current object method calls are being delegated to. def __getobj__ - @_sd_obj + @delegate_sd_obj end # @@ -238,7 +238,7 @@ class SimpleDelegator<Delegator # def __setobj__(obj) raise ArgumentError, "cannot delegate to self" if self.equal?(obj) - @_sd_obj = obj + @delegate_sd_obj = obj end end @@ -269,11 +269,11 @@ def DelegateClass(superclass) klass.module_eval { include Delegator::MethodDelegation def __getobj__ # :nodoc: - @_dc_obj + @delegate_dc_obj end def __setobj__(obj) # :nodoc: raise ArgumentError, "cannot delegate to self" if self.equal?(obj) - @_dc_obj = obj + @delegate_dc_obj = obj end } for method in methods @@ -281,7 +281,7 @@ def DelegateClass(superclass) klass.module_eval <<-EOS, __FILE__, __LINE__+1 def #{method}(*args, &block) begin - @_dc_obj.__send(:#{method}, *args, &block) + @delegate_dc_obj.__send(:#{method}, *args, &block) rescue $@[0,2] = nil raise diff --git a/lib/singleton.rb b/lib/singleton.rb index 2c08f35e37..acacfc48c7 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -39,7 +39,7 @@ # method body is a simple: # # def Klass.instance() -# return @__instance__ +# return @singleton__instance__ # end # # * Klass._load(str) - calling Klass.instance() @@ -101,16 +101,16 @@ module Singleton class << Singleton def __init__(klass) klass.instance_eval { - @__instance__ = nil - @__mutex__ = Mutex.new + @singleton__instance__ = nil + @singleton__mutex__ = Mutex.new } def klass.instance - return @__instance__ if @__instance__ - @__mutex__.synchronize { - return @__instance__ if @__instance__ - @__instance__ = new() + return @singleton__instance__ if @singleton__instance__ + @singleton__mutex__.synchronize { + return @singleton__instance__ if @singleton__instance__ + @singleton__instance__ = new() } - @__instance__ + @singleton__instance__ end klass end @@ -177,13 +177,13 @@ end class << Ups def _instantiate? @enter.push Thread.current[:i] - while false.equal?(@__instance__) - @__mutex__.unlock + while false.equal?(@singleton__instance__) + @singleton__mutex__.unlock sleep 0.08 - @__mutex__.lock + @singleton__mutex__.lock end @leave.push Thread.current[:i] - @__instance__ + @singleton__instance__ end def __sleep @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-02-14" +#define RUBY_RELEASE_DATE "2007-02-15" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20070214 +#define RUBY_RELEASE_CODE 20070215 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 14 +#define RUBY_RELEASE_DAY 15 RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_release_date[]; |