summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-26 14:54:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-26 14:54:51 +0000
commit1cece7f80fec00f3b1d39e549d081501c48213f4 (patch)
tree08cb09c7884807ce528d43067e32bcd7d2e42eac
parent4b159597af39db858f15fba6b7e49cdbf191469a (diff)
* lib/ostruct.rb (OpenStruct::method_missing): prohibit modifying
frozen OpenStruct. [ruby-talk:80214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/ostruct.rb3
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e6b0a01458..d16b94f7ea5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Aug 26 23:53:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/ostruct.rb (OpenStruct::method_missing): prohibit modifying
+ frozen OpenStruct. [ruby-talk:80214]
+
Tue Aug 26 20:03:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (create_tmpsrc): add the hook for source.
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 50a7ceca128..b1ae641dcb5 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -25,6 +25,9 @@ class OpenStruct
if len != 1
raise ArgumentError, "wrong # of arguments (#{len} for 1)", caller(1)
end
+ if self.frozen?
+ raise TypeError, "can't modify frozen #{self.class}", caller(1)
+ end
mname.chop!
@table[mname.intern] = args[0]
elsif len == 0