summaryrefslogtreecommitdiff
path: root/lib/ostruct.rb
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 /lib/ostruct.rb
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
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 50a7cec..b1ae641 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