diff --git a/lib/csv/row.rb b/lib/csv/row.rb
index a2d03e855f..fd293a0326 100644
--- a/lib/csv/row.rb
+++ b/lib/csv/row.rb
@@ -84,7 +84,7 @@ class CSV
def field(header_or_index, minimum_index = 0)
# locate the pair
finder = (header_or_index.is_a?(Integer) || header_or_index.is_a?(Range)) ? :[] : :assoc
- pair = @row[minimum_index..-1].send(finder, header_or_index)
+ pair = @row[minimum_index..-1].public_send(finder, header_or_index)
# return the field if we have a pair
if pair.nil?
diff --git a/lib/drb/observer.rb b/lib/drb/observer.rb
index 3ee15331a1..0fb7301edf 100644
--- a/lib/drb/observer.rb
+++ b/lib/drb/observer.rb
@@ -13,7 +13,7 @@ module DRb
if defined? @observer_peers
@observer_peers.each do |observer, method|
begin
- observer.send(method, *arg)
+ observer.__send__(method, *arg)
rescue
delete_observer(observer)
end
diff --git a/lib/forwardable.rb b/lib/forwardable.rb
index d0f49f7309..c720feb4a4 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -189,7 +189,7 @@ module Forwardable
# If it's not a class or module, it's an instance
mod = Module === self ? self : singleton_class
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
end
@@ -309,7 +309,7 @@ module SingleForwardable
gen = Forwardable._delegator_method(self, accessor, method, ali)
ret = instance_eval(&gen)
- singleton_class.send(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7'
+ singleton_class.__send__(:ruby2_keywords, ali) if RUBY_VERSION >= '2.7'
ret
end
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index 19c78fc910..7566d10be0 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -16,7 +16,7 @@ module IRB
module ExtendCommand
class Fork < Nop
def execute
- pid = send ExtendCommand.irb_original_method_name("fork")
+ pid = __send__ ExtendCommand.irb_original_method_name("fork")
unless pid
class << self
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index c9328e5c5a..6d82139aeb 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -268,7 +268,7 @@ module IRB
PerfectMatchedProc = ->(matched, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding) {
RDocRIDriver ||= RDoc::RI::Driver.new
if matched =~ /\A(?:::)?RubyVM/ and not ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER']
- IRB.send(:easter_egg)
+ IRB.__send__(:easter_egg)
return
end
namespace = retrieve_completion_data(matched, bind: bind, doc_namespace: true)
diff --git a/lib/irb/easter-egg.rb b/lib/irb/easter-egg.rb
index 64869d85fa..3e79692de9 100644
--- a/lib/irb/easter-egg.rb
+++ b/lib/irb/easter-egg.rb
@@ -126,6 +126,7 @@ module IRB
print "\e[H" + buff
sleep 0.05
end
+ rescue Interrupt
ensure
print "\e[0m\e[?1049l"
end
@@ -134,4 +135,4 @@ module IRB
end
end
-IRB.send(:easter_egg, ARGV[0]&.to_sym) if $0 == __FILE__
+IRB.__send__(:easter_egg, ARGV[0]&.to_sym) if $0 == __FILE__
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 2f4fcfb5c6..3cd0c515f1 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -180,7 +180,7 @@ module IRB # :nodoc:
end
end
], nil, __FILE__, line
- send :#{cmd_name}_, *opts, &b
+ __send__ :#{cmd_name}_, *opts, &b
end
], nil, __FILE__, line
else
@@ -268,7 +268,7 @@ module IRB # :nodoc:
def #{cmd_name}(*opts, &b)
Context.module_eval {remove_method(:#{cmd_name})}
require "#{load_file}"
- send :#{cmd_name}, *opts, &b
+ __send__ :#{cmd_name}, *opts, &b
end
for ali in aliases
alias_method ali, cmd_name
@@ -291,8 +291,8 @@ module IRB # :nodoc:
module_eval %[
alias_method alias_name, base_method
def #{base_method}(*opts)
- send :#{extend_method}, *opts
- send :#{alias_name}, *opts
+ __send__ :#{extend_method}, *opts
+ __send__ :#{alias_name}, *opts
end
]
end
@@ -307,8 +307,8 @@ module IRB # :nodoc:
module_eval %[
alias_method alias_name, base_method
def #{base_method}(*opts)
- send :#{alias_name}, *opts
- send :#{extend_method}, *opts
+ __send__ :#{alias_name}, *opts
+ __send__ :#{extend_method}, *opts
end
]
end
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 794a511521..97d3c5f84e 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -52,7 +52,7 @@ EOF
@binding = BINDING_QUEUE.pop
when 3 # binding in function on TOPLEVEL_BINDING(default)
- @binding = eval("self.class.send(:remove_method, :irb_binding) if defined?(irb_binding); private; def irb_binding; binding; end; irb_binding",
+ @binding = eval("self.class.remove_method(:irb_binding) if defined?(irb_binding); private; def irb_binding; binding; end; irb_binding",
TOPLEVEL_BINDING,
__FILE__,
__LINE__ - 3)
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 383579eb71..672c5448fa 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -784,7 +784,7 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
if opt and !opt.empty?
[[:to_str], [:join, " "], [:to_s]].each do |meth, *args|
if opt.respond_to?(meth)
- break opt = opt.send(meth, *args)
+ break opt = opt.__send__(meth, *args)
end
end
opt = "#{opt} #{libs}"
@@ -982,7 +982,7 @@ SRC
if noun
[[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
if noun.respond_to?(meth)
- break noun = noun.send(meth, *args)
+ break noun = noun.__send__(meth, *args)
end
end
unless noun.empty?
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index aff9e7ec60..bd8c8ab476 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -1049,7 +1049,7 @@ module Net
raise FTPProtoError, "invalid time-val: #{value}"
end
usec = fractions.to_i * 10 ** (6 - fractions.to_s.size)
- Time.send(local ? :local : :utc, year, month, day, hour, min, sec, usec)
+ Time.public_send(local ? :local : :utc, year, month, day, hour, min, sec, usec)
}
FACT_PARSERS = Hash.new(CASE_DEPENDENT_PARSER)
FACT_PARSERS["size"] = DECIMAL_PARSER
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index de13d0807c..ae23c0acf9 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -1542,7 +1542,7 @@ module Net
class RawData # :nodoc:
def send_data(imap, tag)
- imap.send(:put_string, @data)
+ imap.__send__(:put_string, @data)
end
def validate
@@ -1557,7 +1557,7 @@ module Net
class Atom # :nodoc:
def send_data(imap, tag)
- imap.send(:put_string, @data)
+ imap.__send__(:put_string, @data)
end
def validate
@@ -1572,7 +1572,7 @@ module Net
class QuotedString # :nodoc:
def send_data(imap, tag)
- imap.send(:send_quoted_string, @data)
+ imap.__send__(:send_quoted_string, @data)
end
def validate
@@ -1587,7 +1587,7 @@ module Net
class Literal # :nodoc:
def send_data(imap, tag)
- imap.send(:send_literal, @data, tag)
+ imap.__send__(:send_literal, @data, tag)
end
def validate
@@ -1602,7 +1602,7 @@ module Net
class MessageSet # :nodoc:
def send_data(imap, tag)
- imap.send(:put_string, format_internal(@data))
+ imap.__send__(:put_string, format_internal(@data))
end
def validate
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 810da77df4..e58d8fb77a 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -745,7 +745,7 @@ module Net
def authenticate(user, secret, authtype = DEFAULT_AUTH_TYPE)
check_auth_method authtype
check_auth_args user, secret
- send auth_method(authtype), user, secret
+ public_send auth_method(authtype), user, secret
end
def auth_plain(user, secret)
diff --git a/lib/observer.rb b/lib/observer.rb
index f242cddc24..fec308b14b 100644
--- a/lib/observer.rb
+++ b/lib/observer.rb
@@ -219,7 +219,7 @@ module Observable
if defined? @observer_state and @observer_state
if defined? @observer_peers
@observer_peers.each do |k, v|
- k.send v, *arg
+ k.__send__(v, *arg)
end
end
@observer_state = false
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 82582f61cb..bc0e821460 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1749,7 +1749,7 @@ XXX
#
def visit(id, *args, &block)
@stack.reverse_each do |el|
- el.send(id, *args, &block)
+ el.__send__(id, *args, &block)
end
nil
end
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index fd1b8e7ee2..d7ff0f630d 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -36,15 +36,15 @@
# Hash keys with spaces or characters that could normally not be used for
# method calls (e.g. ()[]*
) will not be immediately available
# on the OpenStruct object as a method for retrieval or assignment, but can
-# still be reached through the Object#send method or using [].
+# still be reached through the Object#__send__ method or using [].
#
# measurements = OpenStruct.new("length (in inches)" => 24)
# measurements[:"length (in inches)"] # => 24
-# measurements.send("length (in inches)") # => 24
+# measurements.__send__("length (in inches)") # => 24
#
# message = OpenStruct.new(:queued? => true)
# message.queued? # => true
-# message.send("queued?=", false)
+# message.__send__("queued?=", false)
# message.queued? # => false
#
# Removing the presence of an attribute requires the execution of the
diff --git a/lib/racc/grammarfileparser.rb b/lib/racc/grammarfileparser.rb
index 6d63506edf..0351a34e6f 100644
--- a/lib/racc/grammarfileparser.rb
+++ b/lib/racc/grammarfileparser.rb
@@ -288,7 +288,7 @@ module Racc
end
def add_user_code(label, src)
- @result.params.send(USER_CODE_LABELS[label]).push src
+ @result.params.public_send(USER_CODE_LABELS[label]).push src
end
end
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index 6dff96c7d0..2bac76e838 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -156,7 +156,7 @@ class RDoc::Markup::Formatter
method_name = "handle_regexp_#{name}"
if respond_to? method_name then
- target.text = send method_name, target
+ target.text = public_send method_name, target
handled = true
end
end
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 7f70904ad9..d5af47bf40 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -1228,7 +1228,7 @@ or the PAGER environment variable.
# +cache+ indicate if it is a class or instance method.
def load_method store, cache, klass, type, name
- methods = store.send(cache)[klass]
+ methods = store.public_send(cache)[klass]
return unless methods
diff --git a/lib/un.rb b/lib/un.rb
index 628260a7fa..a759328ec4 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -88,7 +88,7 @@ def cp
options[:preserve] = true if options.delete :p
dest = argv.pop
argv = argv[0] if argv.size == 1
- FileUtils.send cmd, argv, dest, **options
+ FileUtils.__send__ cmd, argv, dest, **options
end
end
@@ -109,7 +109,7 @@ def ln
options[:force] = true if options.delete :f
dest = argv.pop
argv = argv[0] if argv.size == 1
- FileUtils.send cmd, argv, dest, **options
+ FileUtils.__send__ cmd, argv, dest, **options
end
end
@@ -144,7 +144,7 @@ def rm
cmd = "rm"
cmd += "_r" if options.delete :r
options[:force] = true if options.delete :f
- FileUtils.send cmd, argv, **options
+ FileUtils.__send__ cmd, argv, **options
end
end
@@ -161,7 +161,7 @@ def mkdir
setup("p") do |argv, options|
cmd = "mkdir"
cmd += "_p" if options.delete :p
- FileUtils.send cmd, argv, **options
+ FileUtils.__send__ cmd, argv, **options
end
end
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 495d57f246..a4192c6557 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1097,7 +1097,7 @@ module URI
# # => "http://my.example.com/main.rbx?page=1"
#
def merge(oth)
- rel = parser.send(:convert_to_uri, oth)
+ rel = parser.__send__(:convert_to_uri, oth)
if rel.absolute?
#raise BadURIError, "both URI are absolute" if absolute?
@@ -1182,7 +1182,7 @@ module URI
# :stopdoc:
def route_from0(oth)
- oth = parser.send(:convert_to_uri, oth)
+ oth = parser.__send__(:convert_to_uri, oth)
if self.relative?
raise BadURIError,
"relative URI: #{self}"
@@ -1290,7 +1290,7 @@ module URI
# #=> #
#
def route_to(oth)
- parser.send(:convert_to_uri, oth).route_from(self)
+ parser.__send__(:convert_to_uri, oth).route_from(self)
end
#
@@ -1404,7 +1404,7 @@ module URI
# Returns an Array of the components defined from the COMPONENT Array.
def component_ary
component.collect do |x|
- self.send(x)
+ self.__send__(x)
end
end
protected :component_ary
@@ -1429,7 +1429,7 @@ module URI
def select(*components)
components.collect do |c|
if component.include?(c)
- self.send(c)
+ self.__send__(c)
else
raise ArgumentError,
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
diff --git a/lib/webrick/httpauth/authenticator.rb b/lib/webrick/httpauth/authenticator.rb
index 8655118a04..8f0eaa3aca 100644
--- a/lib/webrick/httpauth/authenticator.rb
+++ b/lib/webrick/httpauth/authenticator.rb
@@ -85,7 +85,7 @@ module WEBrick
def log(meth, fmt, *args)
msg = format("%s %s: ", @auth_scheme, @realm)
msg << fmt % args
- @logger.send(meth, msg)
+ @logger.__send__(meth, msg)
end
def error(fmt, *args)
diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb
index 496a3ff2d6..7607c3df88 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -115,7 +115,7 @@ module WEBrick
proxy_auth(req, res)
begin
- self.send("do_#{req.request_method}", req, res)
+ public_send("do_#{req.request_method}", req, res)
rescue NoMethodError
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."