summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-02 14:53:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-02 14:53:02 +0000
commitf42208b70cea09612f741523bb84ca0103934352 (patch)
tree6d1723d76ff18cb42093f13789963dbac3214a16 /lib
parentb6a9db500539dba460d91540f22c8e9ea602c280 (diff)
* lib: do not use __send__ to access private methods. [ruby-dev:26935]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/monitor.rb12
-rw-r--r--lib/rss/maker/content.rb4
-rw-r--r--lib/rss/maker/dublincore.rb4
-rw-r--r--lib/rss/maker/image.rb8
-rw-r--r--lib/rss/maker/syndication.rb4
-rw-r--r--lib/rss/maker/trackback.rb8
-rw-r--r--lib/rss/parser.rb2
-rw-r--r--lib/rss/rss.rb2
-rw-r--r--lib/rss/trackback.rb2
-rw-r--r--lib/soap/mapping/mapping.rb2
-rw-r--r--lib/soap/rpc/driver.rb11
-rw-r--r--lib/soap/wsdlDriver.rb11
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb7
-rw-r--r--lib/wsdl/xmlSchema/element.rb7
14 files changed, 44 insertions, 40 deletions
diff --git a/lib/monitor.rb b/lib/monitor.rb
index a573af2..6bd14d0 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -87,11 +87,11 @@ module MonitorMixin
class Timeout < Exception; end
def wait(timeout = nil)
- @monitor.__send__(:mon_check_owner)
+ @monitor.instance_eval {mon_check_owner()}
timer = create_timer(timeout)
Thread.critical = true
- count = @monitor.__send__(:mon_exit_for_cond)
+ count = @monitor.instance_eval {mon_exit_for_cond()}
@waiters.push(Thread.current)
begin
@@ -107,7 +107,7 @@ module MonitorMixin
if @waiters.include?(Thread.current) # interrupted?
@waiters.delete(Thread.current)
end
- @monitor.__send__(:mon_enter_for_cond, count)
+ @monitor.instance_eval {mon_enter_for_cond(count)}
Thread.critical = false
end
end
@@ -125,7 +125,7 @@ module MonitorMixin
end
def signal
- @monitor.__send__(:mon_check_owner)
+ @monitor.instance_eval {mon_check_owner()}
Thread.critical = true
t = @waiters.shift
t.wakeup if t
@@ -134,7 +134,7 @@ module MonitorMixin
end
def broadcast
- @monitor.__send__(:mon_check_owner)
+ @monitor.instance_eval {mon_check_owner()}
Thread.critical = true
for t in @waiters
t.wakeup
@@ -172,7 +172,7 @@ module MonitorMixin
def self.extend_object(obj)
super(obj)
- obj.__send__(:mon_initialize)
+ obj.instance_eval {mon_initialize()}
end
#
diff --git a/lib/rss/maker/content.rb b/lib/rss/maker/content.rb
index 96f3ccb..18590d0 100644
--- a/lib/rss/maker/content.rb
+++ b/lib/rss/maker/content.rb
@@ -10,8 +10,8 @@ module RSS
::RSS::ContentModel::ELEMENTS.each do |element|
klass.add_need_initialize_variable(element)
klass.add_other_element(element)
- klass.__send__(:attr_accessor, element)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_accessor :#{element}
def setup_#{element}(rss, current)
if #{element} and current.respond_to?(:#{element}=)
current.#{element} = @#{element} if @#{element}
diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb
index 29da1c3..e038378 100644
--- a/lib/rss/maker/dublincore.rb
+++ b/lib/rss/maker/dublincore.rb
@@ -18,8 +18,8 @@ module RSS
klass.add_need_initialize_variable(full_plural_name,
"make_#{full_plural_name}")
klass.add_other_element(full_plural_name)
- klass.__send__(:attr_accessor, full_plural_name)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_accessor :#{full_plural_name}
def make_#{full_plural_name}
#{full_plural_klass_name}.new(@maker)
end
diff --git a/lib/rss/maker/image.rb b/lib/rss/maker/image.rb
index 9e3772f..85d9d9c 100644
--- a/lib/rss/maker/image.rb
+++ b/lib/rss/maker/image.rb
@@ -11,8 +11,8 @@ module RSS
name = "#{RSS::IMAGE_PREFIX}_item"
klass.add_need_initialize_variable(name, "make_#{name}")
klass.add_other_element(name)
- klass.__send__(:attr_reader, name)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_reader :#{name}
def setup_#{name}(rss, current)
if @#{name}
@#{name}.to_rss(rss, current)
@@ -52,8 +52,8 @@ EOC
name = "#{RSS::IMAGE_PREFIX}_favicon"
klass.add_need_initialize_variable(name, "make_#{name}")
klass.add_other_element(name)
- klass.__send__(:attr_reader, name)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_reader :#{name}
def setup_#{name}(rss, current)
if @#{name}
@#{name}.to_rss(rss, current)
diff --git a/lib/rss/maker/syndication.rb b/lib/rss/maker/syndication.rb
index 72d00c6..3717086 100644
--- a/lib/rss/maker/syndication.rb
+++ b/lib/rss/maker/syndication.rb
@@ -10,8 +10,8 @@ module RSS
::RSS::SyndicationModel::ELEMENTS.each do |element|
klass.add_need_initialize_variable(element)
klass.add_other_element(element)
- klass.__send__(:attr_accessor, element)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_accessor :#{element}
def setup_#{element}(rss, current)
if #{element} and current.respond_to?(:#{element}=)
current.#{element} = @#{element} if @#{element}
diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb
index 3df2192..b334079 100644
--- a/lib/rss/maker/trackback.rb
+++ b/lib/rss/maker/trackback.rb
@@ -11,8 +11,8 @@ module RSS
name = "#{RSS::TRACKBACK_PREFIX}_ping"
klass.add_need_initialize_variable(name)
klass.add_other_element(name)
- klass.__send__(:attr_accessor, name)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_accessor :#{name}
def setup_#{name}(rss, current)
if #{name} and current.respond_to?(:#{name}=)
current.#{name} = #{name}
@@ -23,8 +23,8 @@ module RSS
name = "#{RSS::TRACKBACK_PREFIX}_abouts"
klass.add_need_initialize_variable(name, "make_#{name}")
klass.add_other_element(name)
- klass.__send__(:attr_accessor, name)
- klass.module_eval(<<-EOC, __FILE__, __LINE__)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__+1)
+ attr_accessor :#{name}
def make_#{name}
self.class::TrackBackAbouts.new(self)
end
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
index df268da..6b3fe06 100644
--- a/lib/rss/parser.rb
+++ b/lib/rss/parser.rb
@@ -409,7 +409,7 @@ module RSS
next_element.do_validate = @do_validate
prefix = ""
prefix << "#{klass.required_prefix}_" if klass.required_prefix
- previous.__send__(:set_next_element, prefix, tag_name, next_element)
+ previous.instance_eval {set_next_element(prefix, tag_name, next_element)}
@last_element = next_element
@proc_stack.push Proc.new { |text, tags|
p(@last_element.class) if DEBUG
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index c200f89..0d3da8b 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -659,7 +659,7 @@ EOC
if parent.respond_to?(plural_name)
target = parent.__send__(plural_name)
__send__(plural_name).each do |elem|
- elem.__send__("setup_maker", target)
+ elem.setup_maker(target)
end
end
end
diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb
index 973a103..6c08350 100644
--- a/lib/rss/trackback.rb
+++ b/lib/rss/trackback.rb
@@ -38,7 +38,7 @@ module RSS
super
unless klass.class == Module
- klass.__send__(:include, TrackBackUtils)
+ klass.module_eval {include TrackBackUtils}
%w(ping).each do |name|
var_name = "#{TRACKBACK_PREFIX}_#{name}"
diff --git a/lib/soap/mapping/mapping.rb b/lib/soap/mapping/mapping.rb
index 626df8c..cc0e6ff 100644
--- a/lib/soap/mapping/mapping.rb
+++ b/lib/soap/mapping/mapping.rb
@@ -254,7 +254,7 @@ module Mapping
def self.define_singleton_method(obj, name, &block)
sclass = (class << obj; self; end)
- sclass.__send__(:define_method, name, &block)
+ sclass.class_eval {define_method(name, &block)}
end
def self.get_attribute(obj, attr_name)
diff --git a/lib/soap/rpc/driver.rb b/lib/soap/rpc/driver.rb
index cb10ed9..096a54f 100644
--- a/lib/soap/rpc/driver.rb
+++ b/lib/soap/rpc/driver.rb
@@ -26,13 +26,14 @@ class Driver
if RUBY_VERSION >= "1.7.0"
def __attr_proxy(symbol, assignable = false)
name = symbol.to_s
- self.__send__(:define_method, name, proc {
+ define_method(name) {
@proxy.__send__(name)
- })
+ }
if assignable
- self.__send__(:define_method, name + '=', proc { |rhs|
- @proxy.__send__(name + '=', rhs)
- })
+ aname = name + '='
+ define_method(aname) { |rhs|
+ @proxy.__send__(aname, rhs)
+ }
end
end
else
diff --git a/lib/soap/wsdlDriver.rb b/lib/soap/wsdlDriver.rb
index 3431d5d..edd069e 100644
--- a/lib/soap/wsdlDriver.rb
+++ b/lib/soap/wsdlDriver.rb
@@ -159,13 +159,14 @@ class WSDLDriver
if RUBY_VERSION >= "1.7.0"
def __attr_proxy(symbol, assignable = false)
name = symbol.to_s
- self.__send__(:define_method, name, proc {
+ define_method(name) {
@servant.__send__(name)
- })
+ }
if assignable
- self.__send__(:define_method, name + '=', proc { |rhs|
- @servant.__send__(name + '=', rhs)
- })
+ aname = name + '='
+ define_method(aname) { |rhs|
+ @servant.__send__(aname, rhs)
+ }
end
end
else
diff --git a/lib/wsdl/xmlSchema/attribute.rb b/lib/wsdl/xmlSchema/attribute.rb
index cfd4c68..c82bd13 100644
--- a/lib/wsdl/xmlSchema/attribute.rb
+++ b/lib/wsdl/xmlSchema/attribute.rb
@@ -18,10 +18,11 @@ class Attribute < Info
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
- self.__send__(:define_method, name, proc {
- instance_variable_get("@#{name}") ||
+ iv = "@#{name}"
+ define_method(name) {
+ instance_variable_get(iv) ||
(refelement ? refelement.__send__(name) : nil)
- })
+ }
end
else
def attr_reader_ref(symbol)
diff --git a/lib/wsdl/xmlSchema/element.rb b/lib/wsdl/xmlSchema/element.rb
index 584afe9..4a144cd 100644
--- a/lib/wsdl/xmlSchema/element.rb
+++ b/lib/wsdl/xmlSchema/element.rb
@@ -18,10 +18,11 @@ class Element < Info
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
- self.__send__(:define_method, name, proc {
- instance_variable_get("@#{name}") ||
+ iv = "@#{name}"
+ define_method(name) {
+ instance_variable_get(iv) ||
(refelement ? refelement.__send__(name) : nil)
- })
+ }
end
else
def attr_reader_ref(symbol)