summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-04 20:36:20 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-04 20:36:20 +0000
commit1eee78b8769f7f01cead3b0782e1ee4ed84e281b (patch)
tree32ac34a556e40ef93a8e4a15f328d36886b4fc45 /lib
parented823523e32e8e8a04123ee5b8ec9c0f3de63c02 (diff)
* eval.c (rb_f_send): allow send/__send__ to call methods of all
visibility again. we no longer provide __send, __send!. * eval.c (rb_invoke_method): new method to honor private visibility. if it's invoked in a function call style, it calls private methods as well (previous 1.9 send behavior). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/date.rb18
-rw-r--r--lib/delegate.rb8
-rw-r--r--lib/drb/drb.rb2
-rw-r--r--lib/matrix.rb2
-rw-r--r--lib/monitor.rb12
-rw-r--r--lib/net/imap.rb10
-rw-r--r--lib/net/smtp.rb2
7 files changed, 27 insertions, 27 deletions
diff --git a/lib/date.rb b/lib/date.rb
index 1d949e59d1..b480e39cfc 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -877,14 +877,14 @@ class Date
when :civil
g[1].each do |e|
break if elem[e]
- elem[e] = d.__send!(e)
+ elem[e] = d.__send__(e)
end
elem[:mon] ||= 1
elem[:mday] ||= 1
when :commercial
g[1].each do |e|
break if elem[e]
- elem[e] = d.__send!(e)
+ elem[e] = d.__send__(e)
end
elem[:cweek] ||= 1
elem[:cwday] ||= 1
@@ -893,14 +893,14 @@ class Date
when :wnum0
g[1].each do |e|
break if elem[e]
- elem[e] = d.__send!(e)
+ elem[e] = d.__send__(e)
end
elem[:wnum0] ||= 0
elem[:wday] ||= 0
when :wnum1
g[1].each do |e|
break if elem[e]
- elem[e] = d.__send!(e)
+ elem[e] = d.__send__(e)
end
elem[:wnum1] ||= 0
elem[:wday] ||= 0
@@ -1727,16 +1727,16 @@ class Time
def to_time() getlocal end
def to_date
- jd = Date.__send!(:civil_to_jd, year, mon, mday, Date::ITALY)
- Date.new!(Date.__send!(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
+ jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::ITALY)
+ Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
end
def to_datetime
- jd = DateTime.__send!(:civil_to_jd, year, mon, mday, DateTime::ITALY)
- fr = DateTime.__send!(:time_to_day_fraction, hour, min, [sec, 59].min) +
+ jd = DateTime.__send__(:civil_to_jd, year, mon, mday, DateTime::ITALY)
+ fr = DateTime.__send__(:time_to_day_fraction, hour, min, [sec, 59].min) +
usec.to_r/86400_000_000
of = utc_offset.to_r/86400
- DateTime.new!(DateTime.__send!(:jd_to_ajd, jd, fr, of),
+ DateTime.new!(DateTime.__send__(:jd_to_ajd, jd, fr, of),
of, DateTime::ITALY)
end
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 9084a7f191..809faa32c6 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -115,7 +115,7 @@
# implementation, see SimpleDelegator.
#
class Delegator
- preserved = [:__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :send!]
+ preserved = [:__id__, :object_id, :__send__, :invoke_method, :respond_to?, :send]
instance_methods.each do |m|
next if preserved.include?(m)
undef_method m
@@ -137,7 +137,7 @@ class Delegator
unless target.respond_to?(m)
super(m, *args, &block)
else
- target.__send(m, *args, &block)
+ target.__send__(m, *args, &block)
end
rescue Exception
$@.delete_if{|s| /^#{__FILE__}:\d+:in `method_missing'$/ =~ s} #`
@@ -262,7 +262,7 @@ def DelegateClass(superclass)
klass = Class.new
methods = superclass.public_instance_methods(true)
methods -= [
- :__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :send!,
+ :__id__, :object_id, :__send__, :invoke_method, :respond_to?, :send,
:==, :equal?, :initialize, :method_missing, :__getobj__, :__setobj__,
:clone, :dup, :marshal_dump, :marshal_load,
]
@@ -281,7 +281,7 @@ def DelegateClass(superclass)
klass.module_eval <<-EOS, __FILE__, __LINE__+1
def #{method}(*args, &block)
begin
- @delegate_dc_obj.__send(:#{method}, *args, &block)
+ @delegate_dc_obj.__send__(:#{method}, *args, &block)
rescue
raise $!, $@[2..-1]
end
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index e7686801f7..a3e0ed927f 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -1553,7 +1553,7 @@ module DRb
end
ary.collect(&@obj)[0]
else
- @obj.send!(@msg_id, *@argv)
+ @obj.send(@msg_id, *@argv)
end
end
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 8f2d472b88..bbb1144e10 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -246,7 +246,7 @@ class Matrix
# use to general users.
#
def initialize(init_method, *argv)
- self.send!(init_method, *argv)
+ self.send(init_method, *argv)
end
def init_rows(rows, copy)
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 1b61f54dba..31234819b8 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -91,13 +91,13 @@ module MonitorMixin
if timeout
raise NotImplementedError, "timeout is not implemented yet"
end
- @monitor.send!(:mon_check_owner)
- count = @monitor.send!(:mon_exit_for_cond)
+ @monitor.send(:mon_check_owner)
+ count = @monitor.send(:mon_exit_for_cond)
begin
@cond.wait(@monitor.instance_variable_get("@mon_mutex"))
return true
ensure
- @monitor.send!(:mon_enter_for_cond, count)
+ @monitor.send(:mon_enter_for_cond, count)
end
end
@@ -114,12 +114,12 @@ module MonitorMixin
end
def signal
- @monitor.send!(:mon_check_owner)
+ @monitor.send(:mon_check_owner)
@cond.signal
end
def broadcast
- @monitor.send!(:mon_check_owner)
+ @monitor.send(:mon_check_owner)
@cond.broadcast
end
@@ -137,7 +137,7 @@ module MonitorMixin
def self.extend_object(obj)
super(obj)
- obj.send!(:mon_initialize)
+ obj.send(:mon_initialize)
end
#
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index f84229f131..087306e8d3 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -1229,7 +1229,7 @@ module Net
class RawData # :nodoc:
def send_data(imap)
- imap.send!(:put_string, @data)
+ imap.send(:put_string, @data)
end
private
@@ -1241,7 +1241,7 @@ module Net
class Atom # :nodoc:
def send_data(imap)
- imap.send!(:put_string, @data)
+ imap.send(:put_string, @data)
end
private
@@ -1253,7 +1253,7 @@ module Net
class QuotedString # :nodoc:
def send_data(imap)
- imap.send!(:send_quoted_string, @data)
+ imap.send(:send_quoted_string, @data)
end
private
@@ -1265,7 +1265,7 @@ module Net
class Literal # :nodoc:
def send_data(imap)
- imap.send!(:send_literal, @data)
+ imap.send(:send_literal, @data)
end
private
@@ -1277,7 +1277,7 @@ module Net
class MessageSet # :nodoc:
def send_data(imap)
- imap.send!(:put_string, format_internal(@data))
+ imap.send(:put_string, format_internal(@data))
end
private
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 84790450bc..8f81ae8450 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -722,7 +722,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
+ send auth_method(authtype), user, secret
end
def auth_plain(user, secret)