Project

General

Profile

Actions

Bug #10557

closed

Block not given when the argument is a string

Added by bartoszkopinski (Bartosz Kopinski) about 10 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2.0dev (2014-11-30 trunk 48655) [x86_64-darwin14]
[ruby-core:66595]

Description

This seems really weird and random. Can anyone else confirm it's bug?

class Klass
  def [](_)
    block_given?
  end
end

# ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
Klass.new.[](nil){ }    # => true
Klass.new.[](0){ }      # => true
Klass.new.[](false){ }  # => true
Klass.new.[](''){ }     # => true

# ruby 2.2.0dev (2014-11-30 trunk 48655) [x86_64-darwin14]
Klass.new.[](nil){ }    # => true
Klass.new.[](0){ }      # => true
Klass.new.[](false){ }  # => true
Klass.new.[](''){ }     # => false
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0