Module#attr_reader/writer are public methods since Ruby 2.5

This commit is contained in:
Akira Matsuda 2020-10-27 00:54:12 +09:00
parent b37473ebbd
commit 1f86a17031
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class Module
def attr_internal_define(attr_name, type)
internal_name = attr_internal_ivar_name(attr_name).delete_prefix("@")
# use native attr_* methods as they are faster on some Ruby implementations
send("attr_#{type}", internal_name)
public_send("attr_#{type}", internal_name)
attr_name, internal_name = "#{attr_name}=", "#{internal_name}=" if type == :writer
alias_method attr_name, internal_name
remove_method internal_name