aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
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: