Prefer #send over #__send__ when it is clear there is no possible conflict

* Reverts part of 3198e7abd70bd2af977f2bb6c967e9df8f91adb0.
* If the rule is #send should be deprecated, that should be ruled by matz,
  there is no such rule currently and gems seem to prefer #send
  overwhelmingly.
This commit is contained in:
Benoit Daloze 2020-11-05 11:23:27 +01:00
parent 2aa9a50dcc
commit 4dba0c1a8e
5 changed files with 8 additions and 8 deletions

View File

@ -189,7 +189,7 @@ module Forwardable
# If it's not a class or module, it's an instance # If it's not a class or module, it's an instance
mod = Module === self ? self : singleton_class mod = Module === self ? self : singleton_class
ret = mod.module_eval(&gen) ret = mod.module_eval(&gen)
mod.__send__(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7' mod.send(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7'
ret ret
end end

View File

@ -16,7 +16,7 @@ module IRB
module ExtendCommand module ExtendCommand
class Fork < Nop class Fork < Nop
def execute def execute
pid = __send__ ExtendCommand.irb_original_method_name("fork") pid = send ExtendCommand.irb_original_method_name("fork")
unless pid unless pid
class << self class << self
alias_method :exit, ExtendCommand.irb_original_method_name('exit') alias_method :exit, ExtendCommand.irb_original_method_name('exit')

View File

@ -268,7 +268,7 @@ module IRB
PerfectMatchedProc = ->(matched, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding) { PerfectMatchedProc = ->(matched, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding) {
RDocRIDriver ||= RDoc::RI::Driver.new RDocRIDriver ||= RDoc::RI::Driver.new
if matched =~ /\A(?:::)?RubyVM/ and not ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER'] if matched =~ /\A(?:::)?RubyVM/ and not ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER']
IRB.__send__(:easter_egg) IRB.send(:easter_egg)
return return
end end
namespace = retrieve_completion_data(matched, bind: bind, doc_namespace: true) namespace = retrieve_completion_data(matched, bind: bind, doc_namespace: true)

View File

@ -135,4 +135,4 @@ module IRB
end end
end end
IRB.__send__(:easter_egg, ARGV[0]&.to_sym) if $0 == __FILE__ IRB.send(:easter_egg, ARGV[0]&.to_sym) if $0 == __FILE__

View File

@ -88,7 +88,7 @@ def cp
options[:preserve] = true if options.delete :p options[:preserve] = true if options.delete :p
dest = argv.pop dest = argv.pop
argv = argv[0] if argv.size == 1 argv = argv[0] if argv.size == 1
FileUtils.__send__ cmd, argv, dest, **options FileUtils.send cmd, argv, dest, **options
end end
end end
@ -109,7 +109,7 @@ def ln
options[:force] = true if options.delete :f options[:force] = true if options.delete :f
dest = argv.pop dest = argv.pop
argv = argv[0] if argv.size == 1 argv = argv[0] if argv.size == 1
FileUtils.__send__ cmd, argv, dest, **options FileUtils.send cmd, argv, dest, **options
end end
end end
@ -144,7 +144,7 @@ def rm
cmd = "rm" cmd = "rm"
cmd += "_r" if options.delete :r cmd += "_r" if options.delete :r
options[:force] = true if options.delete :f options[:force] = true if options.delete :f
FileUtils.__send__ cmd, argv, **options FileUtils.send cmd, argv, **options
end end
end end
@ -161,7 +161,7 @@ def mkdir
setup("p") do |argv, options| setup("p") do |argv, options|
cmd = "mkdir" cmd = "mkdir"
cmd += "_p" if options.delete :p cmd += "_p" if options.delete :p
FileUtils.__send__ cmd, argv, **options FileUtils.send cmd, argv, **options
end end
end end