3
Jan
2023
gotcha: ruby []=
Another wat moment with:
class Bam
def []=(key, value)
"bam"
end
end
irb> # I'm expecting "bam" to be the return value
irb> Bam.new[:ham] = :bacon
# => :bacon
irb> # But this works as expected
irb> Bam.new.public_send(:[]=, :ham, :bacon)
# => "bam"