From: "palkan (Vladimir Dementyev)" Date: 2022-05-24T01:59:40+00:00 Subject: [ruby-core:108661] [Ruby master Bug#18799] Refinement#import_methods vs attr_reader Issue #18799 has been updated by palkan (Vladimir Dementyev). UPD: looks like `define_method` is not supported, too: ```ruby module M define_method(:fuu) { } end module R refine Object do import_methods M end end #=> Can't import method which is not defined with Ruby code: M#fuu (ArgumentError) ``` ---------------------------------------- Bug #18799: Refinement#import_methods vs attr_reader https://bugs.ruby-lang.org/issues/18799#change-97704 * Author: palkan (Vladimir Dementyev) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin21] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Currently, it's not possible to import methods defined as attr_{reader, accessor,writer}: ```ruby module M attr_reader :fuu end module R refine Object do import_methods M end end #=> Can't import method which is not defined with Ruby code: M#fuu (ArgumentError) ``` Is that a known/intentional limitation or a bug? From the error message it might seem that this is a bug (since `attr_smth` is a Ruby code). -- https://bugs.ruby-lang.org/ Unsubscribe: