Project

General

Profile

Actions

Bug #10812

closed

Object#respond_to? doesn't acknowledge active refinements

Added by pabloh (Pablo Herrero) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
[ruby-core:67929]

Description

Object#respond_to? seems to ignore active refinements.

Take for instance the following code:

module R1
  refine String do
    def foobar
      'foobar'
    end
  end
end

puts 'string'.respond_to?(:foobar) # Returns false

using R1

puts 'string'.foobar # Returns 'foobar'
puts 'string'.respond_to?(:foobar) # Is still false

Also seems to equally fail at ruby 2.1.5

Updated by pabloh (Pablo Herrero) over 10 years ago

Aparently this is at the Refinements Specification, sorry for not seeing this before. Please close this issue.

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0