summaryrefslogtreecommitdiff
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 33d669e3db..f3b4608ee8 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -177,15 +177,15 @@ class OpenStruct
def method_missing(mid, *args) # :nodoc:
mname = mid.id2name
len = args.length
- if mname.chomp!('=')
+ if mname.chomp!('=') && mid != :[]=
if len != 1
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
modifiable[new_ostruct_member(mname)] = args[0]
- elsif len == 0
+ elsif len == 0 && mid != :[]
@table[mid]
else
- raise NoMethodError, "undefined method `#{mname}' for #{self}", caller(1)
+ raise NoMethodError, "undefined method `#{mid}' for #{self}", caller(1)
end
end