From: nobu@... Date: 2017-03-19T23:48:36+00:00 Subject: [ruby-core:80245] [Ruby trunk Bug#13326][Rejected] Forwarding methods to :method_missing produces a warning Issue #13326 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Rejected When you define `method_missing` method, you should define `respond_to_missing?` method too. ---------------------------------------- Bug #13326: Forwarding methods to :method_missing produces a warning https://bugs.ruby-lang.org/issues/13326#change-63684 * Author: ojab (ojab ojab) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.0p0 * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Since 2.4 forwarding methods to private methods is deprecated (https://bugs.ruby-lang.org/issues/12782) and `method_missing` is private one, so something like ```ruby require 'forwardable' class PostOffice def method_missing(*args); end end class Courier extend Forwardable def_delegators :@post_office, :deliver def initialize @post_office = PostOffice.new end end Courier.new.deliver ``` produces ``` /tmp/1.rb:17:in `
': Courier#deliver at /Users/ojab/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/forwardable.rb:156 forwarding to private method PostOffice#deliver ``` It's used by shoulda-marchers [for object doubles](https://github.com/thoughtbot/shoulda-matchers/blob/master/lib/shoulda/matchers/doublespeak/object_double.rb). This bug is created to know if such usage is really deprecated and will break in the future or `method_missing` is a special case that will be supported. -- https://bugs.ruby-lang.org/ Unsubscribe: