[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

lib/ostruct.rb 1.12 - wrong commit?

From: Eivind Eklund <eivind@...>
Date: 2004-11-04 17:49:51 UTC
List: ruby-core #3687
The above mentioned commit makes OpenStructs into singletons, which
again makes it impossible to dump them with Marshal.dump.  This breaks
rpa-base internally.  

Below is the diff in question.  The commit message for lib/ostruct.rb
only mention different files, so it looks like this may be a mistake?

Index: lib/ostruct.rb
===================================================================
RCS file: /home/rubycvs/ruby/lib/ostruct.rb,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- lib/ostruct.rb	29 Mar 2004 07:54:31 -0000	1.11
+++ lib/ostruct.rb	27 Oct 2004 09:29:24 -0000	1.12
@@ -58,6 +58,13 @@
     @table = @table.dup
   end
 
+  def new_ostruct_member(name)
+    self.instance_eval %{
+      def #{name}; @table[:#{name}]; end
+      def #{name}=(x); @table[:#{name}] = x; end
+    }
+  end
+
   def method_missing(mid, *args) # :nodoc:
     mname = mid.id2name
     len = args.length
@@ -70,6 +77,7 @@
       end
       mname.chop!
       @table[mname.intern] = args[0]
+      self.new_ostruct_member(mname)
     elsif len == 0
       @table[mid]
     else

In This Thread

Prev Next