1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss/: use #__send__ instead of #send.

* test/rss/: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2005-11-23 09:49:02 +00:00
parent 4cfc20b20d
commit 73cd292fcd
17 changed files with 117 additions and 99 deletions

View file

@ -1,3 +1,12 @@
Wed Nov 23 18:46:53 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/: use #__send__ instead of #send.
* test/rss/: ditto.
Wed Nov 23 18:32:56 2005 Kouhei Sutou <kou@cozmixng.org>
* test/rss/test_taxonomy.rb: use #reject directory.
Wed Nov 23 18:26:00 2005 Kouhei Sutou <kou@cozmixng.org> Wed Nov 23 18:26:00 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/taxonomy.rb: changed class or module prefix to * lib/rss/taxonomy.rb: changed class or module prefix to

View file

@ -79,7 +79,7 @@ module RSS
[ [
[nil, 'channel'], [nil, 'channel'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end
@ -195,7 +195,7 @@ module RSS
"textInput", "textInput",
"cloud", "cloud",
].delete_if do |name| ].delete_if do |name|
send(name).nil? __send__(name).nil?
end.collect do |elem| end.collect do |elem|
[nil, elem] [nil, elem]
end end
@ -358,7 +358,7 @@ module RSS
private private
def _tags def _tags
%w(url title link width height description).delete_if do |name| %w(url title link width height description).delete_if do |name|
send(name).nil? __send__(name).nil?
end.collect do |elem| end.collect do |elem|
[nil, elem] [nil, elem]
end end
@ -460,7 +460,7 @@ module RSS
def _tags def _tags
rv = %w(title link description author comments rv = %w(title link description author comments
source enclosure).delete_if do |name| source enclosure).delete_if do |name|
send(name).nil? __send__(name).nil?
end.collect do |name| end.collect do |name|
[nil, name] [nil, name]
end end
@ -635,7 +635,7 @@ module RSS
private private
def _tags def _tags
%w(title description name link).each do |name| %w(title description name link).each do |name|
send(name).nil? __send__(name).nil?
end.collect do |elem| end.collect do |elem|
[nil, elem] [nil, elem]
end end

View file

@ -87,7 +87,7 @@ module RSS
rv = [ rv = [
[::RSS::URI, "channel"], [::RSS::URI, "channel"],
[::RSS::URI, "image"], [::RSS::URI, "image"],
].delete_if {|uri, name| send(name).nil?} ].delete_if {|uri, name| __send__(name).nil?}
@item.each do |item| @item.each do |item|
rv << [::RSS::URI, "item"] rv << [::RSS::URI, "item"]
end end
@ -326,7 +326,7 @@ module RSS
[::RSS::URI, 'items'], [::RSS::URI, 'items'],
[::RSS::URI, 'textinput'], [::RSS::URI, 'textinput'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end
@ -532,7 +532,7 @@ module RSS
[::RSS::URI, 'url'], [::RSS::URI, 'url'],
[::RSS::URI, 'link'], [::RSS::URI, 'link'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end
@ -602,7 +602,7 @@ module RSS
[::RSS::URI, 'link'], [::RSS::URI, 'link'],
[::RSS::URI, 'description'], [::RSS::URI, 'description'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end
@ -679,7 +679,7 @@ module RSS
[::RSS::URI, 'name'], [::RSS::URI, 'name'],
[::RSS::URI, 'link'], [::RSS::URI, 'link'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end

View file

@ -48,7 +48,7 @@ EOT
alias _tags09 _tags alias _tags09 _tags
def _tags def _tags
rv = %w(generator ttl).delete_if do |name| rv = %w(generator ttl).delete_if do |name|
send(name).nil? __send__(name).nil?
end.collect do |elem| end.collect do |elem|
[nil, elem] [nil, elem]
end + _tags09 end + _tags09
@ -109,7 +109,7 @@ EOT
alias _tags09 _tags alias _tags09 _tags
def _tags def _tags
%w(comments author pubDate guid).delete_if do |name| %w(comments author pubDate guid).delete_if do |name|
send(name).nil? __send__(name).nil?
end.collect do |elem| end.collect do |elem|
[nil, elem] [nil, elem]
end + _tags09 end + _tags09

View file

@ -106,7 +106,7 @@ module RSS
[IMAGE_URI, 'width'], [IMAGE_URI, 'width'],
[IMAGE_URI, 'height'], [IMAGE_URI, 'height'],
].delete_if do |uri, name| ].delete_if do |uri, name|
send(name).nil? __send__(name).nil?
end end
end end

View file

@ -91,7 +91,7 @@ module RSS
variables.each do |var| variables.each do |var|
setter = "#{var}=" setter = "#{var}="
if target.respond_to?(setter) if target.respond_to?(setter)
value = self.__send__(var) value = __send__(var)
if value if value
target.__send__(setter, value) target.__send__(setter, value)
set = true set = true

View file

@ -226,7 +226,7 @@ module RSS
end end
end end
EOT EOT
send("private", "start_#{name}") __send__("private", "start_#{name}")
end end
end end
@ -285,7 +285,7 @@ module RSS
@tag_stack.last.push([ns[prefix], local]) @tag_stack.last.push([ns[prefix], local])
@tag_stack.push([]) @tag_stack.push([])
if respond_to?("start_#{local}", true) if respond_to?("start_#{local}", true)
send("start_#{local}", local, prefix, attrs, ns.dup) __send__("start_#{local}", local, prefix, attrs, ns.dup)
else else
start_else_element(local, prefix, attrs, ns.dup) start_else_element(local, prefix, attrs, ns.dup)
end end
@ -358,7 +358,7 @@ module RSS
setter = self.class.setter(required_uri, tag_name) setter = self.class.setter(required_uri, tag_name)
setter ||= "#{tag_name}=" setter ||= "#{tag_name}="
if @last_element.respond_to?(setter) if @last_element.respond_to?(setter)
@last_element.send(setter, text.to_s) @last_element.__send__(setter, text.to_s)
else else
if @do_validate and not @ignore_unknown_element if @do_validate and not @ignore_unknown_element
raise NotExceptedTagError.new(tag_name, @last_element.tag_name) raise NotExceptedTagError.new(tag_name, @last_element.tag_name)
@ -405,7 +405,7 @@ module RSS
end end
previous = @last_element previous = @last_element
next_element = klass.send(:new, *args) next_element = klass.__send__(:new, *args)
next_element.do_validate = @do_validate next_element.do_validate = @do_validate
previous.funcall(:set_next_element, tag_name, next_element) previous.funcall(:set_next_element, tag_name, next_element)
@last_element = next_element @last_element = next_element

View file

@ -279,7 +279,7 @@ EOC
else else
if @do_validate if @do_validate
begin begin
@#{name} = Time.send('#{type}', new_value) @#{name} = Time.__send__('#{type}', new_value)
rescue ArgumentError rescue ArgumentError
raise NotAvailableValueError.new('#{disp_name}', new_value) raise NotAvailableValueError.new('#{disp_name}', new_value)
end end
@ -316,7 +316,7 @@ EOC
if args.empty? if args.empty?
@#{accessor_name}.first @#{accessor_name}.first
else else
@#{accessor_name}.send("[]", *args) @#{accessor_name}[*args]
end end
end end
@ -328,7 +328,7 @@ EOC
if args.size == 1 if args.size == 1
@#{accessor_name}.push(args[0]) @#{accessor_name}.push(args[0])
else else
@#{accessor_name}.send("[]=", *args) @#{accessor_name}.__send__("[]=", *args)
end end
end end
alias_method(:set_#{accessor_name}, :#{accessor_name}=) alias_method(:set_#{accessor_name}, :#{accessor_name}=)
@ -703,11 +703,11 @@ EOC
self.class::NSPOOL.each do |prefix, uri| self.class::NSPOOL.each do |prefix, uri|
if tags.has_key?(uri) and !must_call_validators.has_key?(uri) if tags.has_key?(uri) and !must_call_validators.has_key?(uri)
meth = "#{prefix}_validate" meth = "#{prefix}_validate"
send(meth, tags[uri]) if respond_to?(meth, true) __send__(meth, tags[uri]) if respond_to?(meth, true)
end end
end end
must_call_validators.each do |uri, prefix| must_call_validators.each do |uri, prefix|
send("#{prefix}_validate", tags[uri]) __send__("#{prefix}_validate", tags[uri])
end end
end end

View file

@ -70,7 +70,7 @@ module RSS
if args.empty? if args.empty?
@#{var_name}.first and @#{var_name}.first.value @#{var_name}.first and @#{var_name}.first.value
else else
ret = @#{var_name}.send("[]", *args) ret = @#{var_name}.__send__("[]", *args)
if ret.is_a?(Array) if ret.is_a?(Array)
ret.collect {|x| x.value} ret.collect {|x| x.value}
else else
@ -94,7 +94,7 @@ module RSS
else else
new_val = Utils.new_with_value_if_need(#{klass_name}, new_val) new_val = Utils.new_with_value_if_need(#{klass_name}, new_val)
end end
@#{var_name}.send("[]=", *(args[0..-2] + [new_val])) @#{var_name}.__send__("[]=", *(args[0..-2] + [new_val]))
end end
end end
alias set_#{var_name} #{var_name}= alias set_#{var_name} #{var_name}=

View file

@ -37,13 +37,13 @@ module RSS
def initialize(*attrs) def initialize(*attrs)
@do_validate = true @do_validate = true
ATTRIBUTES.each do |attr| ATTRIBUTES.each do |attr|
self.send("#{attr}=", nil) __send__("#{attr}=", nil)
end end
vars = ATTRIBUTES.dup vars = ATTRIBUTES.dup
vars.unshift(:do_validate) vars.unshift(:do_validate)
attrs.each do |name, value| attrs.each do |name, value|
if vars.include?(name.to_s) if vars.include?(name.to_s)
self.send("#{name}=", value) __send__("#{name}=", value)
end end
end end
end end
@ -53,8 +53,8 @@ module RSS
if @href if @href
rv << %Q[<?xml-stylesheet] rv << %Q[<?xml-stylesheet]
ATTRIBUTES.each do |name| ATTRIBUTES.each do |name|
if self.send(name) if __send__(name)
rv << %Q[ #{name}="#{h self.send(name)}"] rv << %Q[ #{name}="#{h __send__(name)}"]
end end
end end
rv << %Q[?>] rv << %Q[?>]

View file

@ -15,10 +15,10 @@ module RSS
module Assertions module Assertions
def assert_parse(rss, assert_method, *args) def assert_parse(rss, assert_method, *args)
send("assert_#{assert_method}", *args) do __send__("assert_#{assert_method}", *args) do
::RSS::Parser.parse(rss) ::RSS::Parser.parse(rss)
end end
send("assert_#{assert_method}", *args) do __send__("assert_#{assert_method}", *args) do
::RSS::Parser.parse(rss, false).validate ::RSS::Parser.parse(rss, false).validate
end end
end end
@ -119,7 +119,7 @@ module RSS
_wrap_assertion do _wrap_assertion do
n_attrs = normalized_attrs(attrs) n_attrs = normalized_attrs(attrs)
::RSS::XMLStyleSheet::ATTRIBUTES.each do |name| ::RSS::XMLStyleSheet::ATTRIBUTES.each do |name|
assert_equal(n_attrs[name], xsl.send(name)) assert_equal(n_attrs[name], xsl.__send__(name))
end end
end end
end end

View file

@ -28,7 +28,7 @@ module RSS
xmldecl = doc.xml_decl xmldecl = doc.xml_decl
%w(version encoding).each do |x| %w(version encoding).each do |x|
assert_equal(instance_eval(x), xmldecl.send(x)) assert_equal(instance_eval(x), xmldecl.__send__(x))
end end
assert_equal(standalone, !xmldecl.standalone.nil?) assert_equal(standalone, !xmldecl.standalone.nil?)
@ -69,7 +69,7 @@ module RSS
channel = RDF::Channel.new(about) channel = RDF::Channel.new(about)
%w(title link description image items textinput).each do |x| %w(title link description image items textinput).each do |x|
channel.send("#{x}=", instance_eval(x)) channel.__send__("#{x}=", instance_eval(x))
end end
doc = REXML::Document.new(make_RDF(channel.to_s)) doc = REXML::Document.new(make_RDF(channel.to_s))
@ -187,7 +187,7 @@ module RSS
image = RDF::Image.new(about) image = RDF::Image.new(about)
%w(title url link).each do |x| %w(title url link).each do |x|
image.send("#{x}=", instance_eval(x)) image.__send__("#{x}=", instance_eval(x))
end end
doc = REXML::Document.new(make_RDF(image.to_s)) doc = REXML::Document.new(make_RDF(image.to_s))
@ -212,7 +212,7 @@ module RSS
item = RDF::Item.new(about) item = RDF::Item.new(about)
%w(title link description).each do |x| %w(title link description).each do |x|
item.send("#{x}=", instance_eval(x)) item.__send__("#{x}=", instance_eval(x))
end end
doc = REXML::Document.new(make_RDF(item.to_s)) doc = REXML::Document.new(make_RDF(item.to_s))
@ -238,7 +238,7 @@ module RSS
textinput = RDF::Textinput.new(about) textinput = RDF::Textinput.new(about)
%w(title link name description).each do |x| %w(title link name description).each do |x|
textinput.send("#{x}=", instance_eval(x)) textinput.__send__("#{x}=", instance_eval(x))
end end
doc = REXML::Document.new(make_RDF(textinput.to_s)) doc = REXML::Document.new(make_RDF(textinput.to_s))

View file

@ -61,21 +61,20 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
@parents.each do |parent| @parents.each do |parent|
meth = "#{RSS::CONTENT_PREFIX}_#{name}" meth = "#{RSS::CONTENT_PREFIX}_#{name}"
assert_equal(value, @rss.send(parent).funcall(meth)) assert_equal(value, @rss.__send__(parent).funcall(meth))
@rss.send(parent).funcall("#{meth}=", new_value[name].to_s) @rss.__send__(parent).funcall("#{meth}=", new_value[name].to_s)
assert_equal(new_value[name], @rss.send(parent).funcall(meth)) assert_equal(new_value[name], @rss.__send__(parent).funcall(meth))
end end
end end
end end
def test_to_s def test_to_s
@elems.each do |name, value| @elems.each do |name, value|
excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>" excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>"
@parents.each do |parent| @parents.each do |parent|
meth = "#{RSS::CONTENT_PREFIX}_#{name}_element" meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
assert_equal(excepted, @rss.send(parent).funcall(meth)) assert_equal(excepted, @rss.__send__(parent).funcall(meth))
end end
end end

View file

@ -87,7 +87,7 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
@parents.each do |parent| @parents.each do |parent|
parsed_value = @rss.send(parent).send("dc_#{name}") parsed_value = @rss.__send__(parent).__send__("dc_#{name}")
if parsed_value.kind_of?(String) if parsed_value.kind_of?(String)
parsed_value = CGI.escapeHTML(parsed_value) parsed_value = CGI.escapeHTML(parsed_value)
end end
@ -97,16 +97,17 @@ EOR
class << t class << t
alias_method(:to_s, :iso8601) alias_method(:to_s, :iso8601)
end end
@rss.send(parent).send("dc_#{name}=", t.iso8601) @rss.__send__(parent).__send__("dc_#{name}=", t.iso8601)
assert_equal(t, @rss.send(parent).send("dc_#{name}")) assert_equal(t, @rss.__send__(parent).__send__("dc_#{name}"))
assert_equal(t, @rss.send(parent).date) assert_equal(t, @rss.__send__(parent).date)
@rss.send(parent).date = value @rss.__send__(parent).date = value
assert_equal(value, @rss.send(parent).date) assert_equal(value, @rss.__send__(parent).date)
assert_equal(value, @rss.send(parent).send("dc_#{name}")) assert_equal(value, @rss.__send__(parent).__send__("dc_#{name}"))
else else
@rss.send(parent).send("dc_#{name}=", new_value) @rss.__send__(parent).__send__("dc_#{name}=", new_value)
assert_equal(new_value, @rss.send(parent).send("dc_#{name}")) assert_equal(new_value,
@rss.__send__(parent).__send__("dc_#{name}"))
end end
end end
end end
@ -117,7 +118,7 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
@parents.each do |parent| @parents.each do |parent|
parsed_value = @rss.send(parent).send("dc_#{name}") parsed_value = @rss.__send__(parent).__send__("dc_#{name}")
if parsed_value.kind_of?(String) if parsed_value.kind_of?(String)
parsed_value = CGI.escapeHTML(parsed_value) parsed_value = CGI.escapeHTML(parsed_value)
end end
@ -131,16 +132,21 @@ EOR
class << t class << t
alias_method(:to_s, :iso8601) alias_method(:to_s, :iso8601)
end end
elems = @rss.send(parent).send(plural_reader) elems = @rss.__send__(parent).__send__(plural_reader)
elems << klass.new(t.iso8601) elems << klass.new(t.iso8601)
values = @rss.send(parent).send(plural_reader).collect{|x| x.value} new_elems = @rss.__send__(parent).__send__(plural_reader)
assert_equal([@rss.send(parent).send("dc_#{name}"), t], values = new_elems.collect{|x| x.value}
assert_equal([@rss.__send__(parent).__send__("dc_#{name}"), t],
values) values)
else else
elems = @rss.send(parent).send(plural_reader) elems = @rss.__send__(parent).__send__(plural_reader)
elems << klass.new(new_value) elems << klass.new(new_value)
values = @rss.send(parent).send(plural_reader).collect{|x| x.value} new_elems = @rss.__send__(parent).__send__(plural_reader)
assert_equal([@rss.send(parent).send("dc_#{name}"), new_value], values = new_elems.collect{|x| x.value}
assert_equal([
@rss.__send__(parent).__send__("dc_#{name}"),
new_value
],
values) values)
end end
end end
@ -151,17 +157,19 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>" excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
@parents.each do |parent| @parents.each do |parent|
assert_equal(excepted, @rss.send(parent).funcall("dc_#{name}_elements")) assert_equal(excepted,
@rss.__send__(parent).funcall("dc_#{name}_elements"))
end end
excepted = Array.new(2, excepted).join("\n") excepted = Array.new(2, excepted).join("\n")
@parents.each do |parent| @parents.each do |parent|
reader = "dc_#{name}" + (name == :rights ? "es" : "s") reader = "dc_#{name}" + (name == :rights ? "es" : "s")
elems = @rss.send(parent).send(reader) elems = @rss.__send__(parent).__send__(reader)
klass_name = "DublinCore#{Utils.to_class_name(name.to_s)}" klass_name = "DublinCore#{Utils.to_class_name(name.to_s)}"
klass = DublinCoreModel.const_get(klass_name) klass = DublinCoreModel.const_get(klass_name)
elems << klass.new(@rss.send(parent).send("dc_#{name}")) elems << klass.new(@rss.__send__(parent).__send__("dc_#{name}"))
assert_equal(excepted, @rss.send(parent).funcall("dc_#{name}_elements")) assert_equal(excepted,
@rss.__send__(parent).funcall("dc_#{name}_elements"))
end end
end end

View file

@ -86,21 +86,21 @@ EOR
%w(size image:size large), %w(size image:size large),
%w(image_size image:size medium), %w(image_size image:size medium),
].each do |name, full_name, new_value| ].each do |name, full_name, new_value|
assert_equal(@favicon_attrs[full_name], favicon.send(name)) assert_equal(@favicon_attrs[full_name], favicon.__send__(name))
favicon.send("#{name}=", new_value) favicon.__send__("#{name}=", new_value)
assert_equal(new_value, favicon.send(name)) assert_equal(new_value, favicon.__send__(name))
favicon.send("#{name}=", @favicon_attrs[full_name]) favicon.__send__("#{name}=", @favicon_attrs[full_name])
assert_equal(@favicon_attrs[full_name], favicon.send(name)) assert_equal(@favicon_attrs[full_name], favicon.__send__(name))
end end
[ [
%w(dc_title dc:title sample-favicon), %w(dc_title dc:title sample-favicon),
].each do |name, full_name, new_value| ].each do |name, full_name, new_value|
assert_equal(@favicon_contents[full_name], favicon.send(name)) assert_equal(@favicon_contents[full_name], favicon.__send__(name))
favicon.send("#{name}=", new_value) favicon.__send__("#{name}=", new_value)
assert_equal(new_value, favicon.send(name)) assert_equal(new_value, favicon.__send__(name))
favicon.send("#{name}=", @favicon_contents[full_name]) favicon.__send__("#{name}=", @favicon_contents[full_name])
assert_equal(@favicon_contents[full_name], favicon.send(name)) assert_equal(@favicon_contents[full_name], favicon.__send__(name))
end end
end end
@ -112,11 +112,11 @@ EOR
%w(about rdf:about http://example.com/image.png), %w(about rdf:about http://example.com/image.png),
%w(resource rdf:resource http://example.com/), %w(resource rdf:resource http://example.com/),
].each do |name, full_name, new_value| ].each do |name, full_name, new_value|
assert_equal(attrs[full_name], image_item.send(name)) assert_equal(attrs[full_name], image_item.__send__(name))
image_item.send("#{name}=", new_value) image_item.__send__("#{name}=", new_value)
assert_equal(new_value, image_item.send(name)) assert_equal(new_value, image_item.__send__(name))
image_item.send("#{name}=", attrs[full_name]) image_item.__send__("#{name}=", attrs[full_name])
assert_equal(attrs[full_name], image_item.send(name)) assert_equal(attrs[full_name], image_item.__send__(name))
end end
[ [
@ -126,11 +126,11 @@ EOR
["image_height", "image:height", 88], ["image_height", "image:height", 88],
["dc_title", "dc:title", "sample-image"], ["dc_title", "dc:title", "sample-image"],
].each do |name, full_name, new_value| ].each do |name, full_name, new_value|
assert_equal(contents[full_name], image_item.send(name)) assert_equal(contents[full_name], image_item.__send__(name))
image_item.send("#{name}=", new_value) image_item.__send__("#{name}=", new_value)
assert_equal(new_value, image_item.send(name)) assert_equal(new_value, image_item.__send__(name))
image_item.send("#{name}=", contents[full_name]) image_item.__send__("#{name}=", contents[full_name])
assert_equal(contents[full_name], image_item.send(name)) assert_equal(contents[full_name], image_item.__send__(name))
end end
end end
end end

View file

@ -74,16 +74,17 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
@parents.each do |parent| @parents.each do |parent|
assert_equal(value, @rss.send(parent).funcall("sy_#{name}")) assert_equal(value, @rss.__send__(parent).funcall("sy_#{name}"))
@rss.send(parent).funcall("sy_#{name}=", new_value[name].to_s) @rss.__send__(parent).funcall("sy_#{name}=", new_value[name].to_s)
assert_equal(new_value[name], @rss.send(parent).funcall("sy_#{name}")) assert_equal(new_value[name],
@rss.__send__(parent).funcall("sy_#{name}"))
end end
end end
%w(hourly daily weekly monthly yearly).each do |x| %w(hourly daily weekly monthly yearly).each do |x|
@parents.each do |parent| @parents.each do |parent|
assert_nothing_raised do assert_nothing_raised do
@rss.send(parent).sy_updatePeriod = x @rss.__send__(parent).sy_updatePeriod = x
end end
end end
end end
@ -91,7 +92,7 @@ EOR
%w(-2 0.3 -0.4).each do |x| %w(-2 0.3 -0.4).each do |x|
@parents.each do |parent| @parents.each do |parent|
assert_not_available_value("updateBase", x) do assert_not_available_value("updateBase", x) do
@rss.send(parent).sy_updateBase = x @rss.__send__(parent).sy_updateBase = x
end end
end end
end end
@ -103,7 +104,8 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>" excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
@parents.each do |parent| @parents.each do |parent|
assert_equal(excepted, @rss.send(parent).funcall("sy_#{name}_element")) assert_equal(excepted,
@rss.__send__(parent).funcall("sy_#{name}_element"))
end end
end end

View file

@ -88,20 +88,20 @@ EOR
@elems.each do |name, value| @elems.each do |name, value|
@parents.each do |parent| @parents.each do |parent|
accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}" accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}"
target = @rss.send(parent) target = @rss.__send__(parent)
target20 = @rss20.channel.send(parent, -1) target20 = @rss20.channel.__send__(parent, -1)
assert_equal(value, target.send(accessor)) assert_equal(value, target.__send__(accessor))
assert_equal(value, target20.send(accessor)) assert_equal(value, target20.__send__(accessor))
if name == :about if name == :about
# abount is zero or more # abount is zero or more
target.send("#{accessor}=", 0, new_value[name].to_s) target.__send__("#{accessor}=", 0, new_value[name].to_s)
target20.send("#{accessor}=", 0, new_value[name].to_s) target20.__send__("#{accessor}=", 0, new_value[name].to_s)
else else
target.send("#{accessor}=", new_value[name].to_s) target.__send__("#{accessor}=", new_value[name].to_s)
target20.send("#{accessor}=", new_value[name].to_s) target20.__send__("#{accessor}=", new_value[name].to_s)
end end
assert_equal(new_value[name], target.send(accessor)) assert_equal(new_value[name], target.__send__(accessor))
assert_equal(new_value[name], target20.send(accessor)) assert_equal(new_value[name], target20.__send__(accessor))
end end
end end
@ -114,7 +114,7 @@ EOR
@parents.each do |parent| @parents.each do |parent|
meth = "#{RSS::TRACKBACK_PREFIX}_#{name}_element" meth = "#{RSS::TRACKBACK_PREFIX}_#{name}_element"
meth << "s" if name == :about meth << "s" if name == :about
assert_equal(excepted, @rss.send(parent).funcall(meth)) assert_equal(excepted, @rss.__send__(parent).funcall(meth))
end end
end end