summaryrefslogtreecommitdiff
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-03 05:17:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-03 05:17:25 +0000
commit4ec86dcc5761a3eaca546ffe121c9d03d7e1e0cd (patch)
tree64ec056c5cd3730d9a1b52fd4c73e1398866c3ad /lib/ostruct.rb
parent742d440cba11e4c4a72f6b8d1bbaadc207553243 (diff)
* lib/ostruct.rb (OpenStruct#delete_field): also undefine
accessor methods. [ruby-core:33010] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index aea0c8e124..e50da65181 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -107,7 +107,9 @@ class OpenStruct
# Remove the named field from the object.
#
def delete_field(name)
- @table.delete name.to_sym
+ sym = name.to_sym
+ @table.delete sym
+ singleton_class.__send__(:remove_method, sym, "#{name}=")
end
InspectKey = :__inspect_key__ # :nodoc: