I was debugging a Reby script and came across a most unusual error:
Reby error: string not matched chanstats.rb:43:in `[]=’
Line 43 was:
@stats[ channel ][ :size_record ] ||= 0
which looks rather innocuous. I have a couple Hashes, one nested in the other. Or so I thought… Apparently, I had mistakenly initialized @stats with a string instead of a Hash. Testing in irb, everything becomes clear:
irb(main):001:0> s = "string" => "string" irb(main):006:0> s[ 'hi' ] = 'foo' IndexError: string not matched from (irb):6:in `[]='
I hope this helps people who can’t figure out why they’re getting “string not matched”.
Share This