From f983896e0b809e3e040b432e4bc1fbf7953eab45 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 27 Feb 2009 05:23:10 +0000 Subject: * lib/ostruct.rb (modifiable): check if really frozen. [ruby-core:22559] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/ostruct.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 45ebb8083..0ac685243 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -68,8 +68,10 @@ class OpenStruct end def modifiable - if self.frozen? - raise TypeError, "can't modify frozen #{self.class}", caller(2) + begin + @modifiable = true + rescue + raise TypeError, "can't modify frozen #{self.class}", caller(3) end @table end -- cgit