summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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