S
Simon Strandgaard
While adding a testcase to rubicon for Array#fetch, I discovered that
#fetch takes a second argument. However I cannot figure out what its
purpose are. I have tried with lots of different input.
server> irb
irb(main):001:0> %w(a b c).fetch(1, 500)
=> "b"
irb(main):002:0> %w(a b c).fetch(1, -9)
=> "b"
irb(main):003:0> %w(a b c).fetch(1, nil)
=> "b"
irb(main):004:0>
It looks like a bug to me.
#fetch takes a second argument. However I cannot figure out what its
purpose are. I have tried with lots of different input.
server> irb
irb(main):001:0> %w(a b c).fetch(1, 500)
=> "b"
irb(main):002:0> %w(a b c).fetch(1, -9)
=> "b"
irb(main):003:0> %w(a b c).fetch(1, nil)
=> "b"
irb(main):004:0>
It looks like a bug to me.