From: "Eregon (Benoit Daloze)" Date: 2022-05-24T19:53:32+00:00 Subject: [ruby-core:108679] [Ruby master Bug#18799] Refinement#import_methods vs attr_reader Issue #18799 has been updated by Eregon (Benoit Daloze). > is not defined with Ruby code It means the method's body is not Ruby code. And indeed, `attr_*` defines methods which are not defined in/with Ruby code. So this seems expected. Same for define_method, which has some internal wrapper around the given block and so cannot easily be import-ed. ---------------------------------------- Bug #18799: Refinement#import_methods vs attr_reader https://bugs.ruby-lang.org/issues/18799#change-97720 * 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: