avatar

An hero

coder by day, an hero by night

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"