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:
parent
4cfc20b20d
commit
73cd292fcd
17 changed files with 117 additions and 99 deletions
|
@ -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>
|
||||
|
||||
* lib/rss/taxonomy.rb: changed class or module prefix to
|
||||
|
|
|
@ -79,7 +79,7 @@ module RSS
|
|||
[
|
||||
[nil, 'channel'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -195,7 +195,7 @@ module RSS
|
|||
"textInput",
|
||||
"cloud",
|
||||
].delete_if do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |elem|
|
||||
[nil, elem]
|
||||
end
|
||||
|
@ -358,7 +358,7 @@ module RSS
|
|||
private
|
||||
def _tags
|
||||
%w(url title link width height description).delete_if do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |elem|
|
||||
[nil, elem]
|
||||
end
|
||||
|
@ -460,7 +460,7 @@ module RSS
|
|||
def _tags
|
||||
rv = %w(title link description author comments
|
||||
source enclosure).delete_if do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |name|
|
||||
[nil, name]
|
||||
end
|
||||
|
@ -635,7 +635,7 @@ module RSS
|
|||
private
|
||||
def _tags
|
||||
%w(title description name link).each do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |elem|
|
||||
[nil, elem]
|
||||
end
|
||||
|
|
|
@ -87,7 +87,7 @@ module RSS
|
|||
rv = [
|
||||
[::RSS::URI, "channel"],
|
||||
[::RSS::URI, "image"],
|
||||
].delete_if {|uri, name| send(name).nil?}
|
||||
].delete_if {|uri, name| __send__(name).nil?}
|
||||
@item.each do |item|
|
||||
rv << [::RSS::URI, "item"]
|
||||
end
|
||||
|
@ -326,7 +326,7 @@ module RSS
|
|||
[::RSS::URI, 'items'],
|
||||
[::RSS::URI, 'textinput'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -532,7 +532,7 @@ module RSS
|
|||
[::RSS::URI, 'url'],
|
||||
[::RSS::URI, 'link'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -602,7 +602,7 @@ module RSS
|
|||
[::RSS::URI, 'link'],
|
||||
[::RSS::URI, 'description'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -679,7 +679,7 @@ module RSS
|
|||
[::RSS::URI, 'name'],
|
||||
[::RSS::URI, 'link'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ EOT
|
|||
alias _tags09 _tags
|
||||
def _tags
|
||||
rv = %w(generator ttl).delete_if do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |elem|
|
||||
[nil, elem]
|
||||
end + _tags09
|
||||
|
@ -109,7 +109,7 @@ EOT
|
|||
alias _tags09 _tags
|
||||
def _tags
|
||||
%w(comments author pubDate guid).delete_if do |name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end.collect do |elem|
|
||||
[nil, elem]
|
||||
end + _tags09
|
||||
|
|
|
@ -106,7 +106,7 @@ module RSS
|
|||
[IMAGE_URI, 'width'],
|
||||
[IMAGE_URI, 'height'],
|
||||
].delete_if do |uri, name|
|
||||
send(name).nil?
|
||||
__send__(name).nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ module RSS
|
|||
variables.each do |var|
|
||||
setter = "#{var}="
|
||||
if target.respond_to?(setter)
|
||||
value = self.__send__(var)
|
||||
value = __send__(var)
|
||||
if value
|
||||
target.__send__(setter, value)
|
||||
set = true
|
||||
|
|
|
@ -226,7 +226,7 @@ module RSS
|
|||
end
|
||||
end
|
||||
EOT
|
||||
send("private", "start_#{name}")
|
||||
__send__("private", "start_#{name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -285,7 +285,7 @@ module RSS
|
|||
@tag_stack.last.push([ns[prefix], local])
|
||||
@tag_stack.push([])
|
||||
if respond_to?("start_#{local}", true)
|
||||
send("start_#{local}", local, prefix, attrs, ns.dup)
|
||||
__send__("start_#{local}", local, prefix, attrs, ns.dup)
|
||||
else
|
||||
start_else_element(local, prefix, attrs, ns.dup)
|
||||
end
|
||||
|
@ -358,7 +358,7 @@ module RSS
|
|||
setter = self.class.setter(required_uri, tag_name)
|
||||
setter ||= "#{tag_name}="
|
||||
if @last_element.respond_to?(setter)
|
||||
@last_element.send(setter, text.to_s)
|
||||
@last_element.__send__(setter, text.to_s)
|
||||
else
|
||||
if @do_validate and not @ignore_unknown_element
|
||||
raise NotExceptedTagError.new(tag_name, @last_element.tag_name)
|
||||
|
@ -405,7 +405,7 @@ module RSS
|
|||
end
|
||||
|
||||
previous = @last_element
|
||||
next_element = klass.send(:new, *args)
|
||||
next_element = klass.__send__(:new, *args)
|
||||
next_element.do_validate = @do_validate
|
||||
previous.funcall(:set_next_element, tag_name, next_element)
|
||||
@last_element = next_element
|
||||
|
|
|
@ -279,7 +279,7 @@ EOC
|
|||
else
|
||||
if @do_validate
|
||||
begin
|
||||
@#{name} = Time.send('#{type}', new_value)
|
||||
@#{name} = Time.__send__('#{type}', new_value)
|
||||
rescue ArgumentError
|
||||
raise NotAvailableValueError.new('#{disp_name}', new_value)
|
||||
end
|
||||
|
@ -316,7 +316,7 @@ EOC
|
|||
if args.empty?
|
||||
@#{accessor_name}.first
|
||||
else
|
||||
@#{accessor_name}.send("[]", *args)
|
||||
@#{accessor_name}[*args]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -328,7 +328,7 @@ EOC
|
|||
if args.size == 1
|
||||
@#{accessor_name}.push(args[0])
|
||||
else
|
||||
@#{accessor_name}.send("[]=", *args)
|
||||
@#{accessor_name}.__send__("[]=", *args)
|
||||
end
|
||||
end
|
||||
alias_method(:set_#{accessor_name}, :#{accessor_name}=)
|
||||
|
@ -703,11 +703,11 @@ EOC
|
|||
self.class::NSPOOL.each do |prefix, uri|
|
||||
if tags.has_key?(uri) and !must_call_validators.has_key?(uri)
|
||||
meth = "#{prefix}_validate"
|
||||
send(meth, tags[uri]) if respond_to?(meth, true)
|
||||
__send__(meth, tags[uri]) if respond_to?(meth, true)
|
||||
end
|
||||
end
|
||||
must_call_validators.each do |uri, prefix|
|
||||
send("#{prefix}_validate", tags[uri])
|
||||
__send__("#{prefix}_validate", tags[uri])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ module RSS
|
|||
if args.empty?
|
||||
@#{var_name}.first and @#{var_name}.first.value
|
||||
else
|
||||
ret = @#{var_name}.send("[]", *args)
|
||||
ret = @#{var_name}.__send__("[]", *args)
|
||||
if ret.is_a?(Array)
|
||||
ret.collect {|x| x.value}
|
||||
else
|
||||
|
@ -94,7 +94,7 @@ module RSS
|
|||
else
|
||||
new_val = Utils.new_with_value_if_need(#{klass_name}, new_val)
|
||||
end
|
||||
@#{var_name}.send("[]=", *(args[0..-2] + [new_val]))
|
||||
@#{var_name}.__send__("[]=", *(args[0..-2] + [new_val]))
|
||||
end
|
||||
end
|
||||
alias set_#{var_name} #{var_name}=
|
||||
|
|
|
@ -37,13 +37,13 @@ module RSS
|
|||
def initialize(*attrs)
|
||||
@do_validate = true
|
||||
ATTRIBUTES.each do |attr|
|
||||
self.send("#{attr}=", nil)
|
||||
__send__("#{attr}=", nil)
|
||||
end
|
||||
vars = ATTRIBUTES.dup
|
||||
vars.unshift(:do_validate)
|
||||
attrs.each do |name, value|
|
||||
if vars.include?(name.to_s)
|
||||
self.send("#{name}=", value)
|
||||
__send__("#{name}=", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -53,8 +53,8 @@ module RSS
|
|||
if @href
|
||||
rv << %Q[<?xml-stylesheet]
|
||||
ATTRIBUTES.each do |name|
|
||||
if self.send(name)
|
||||
rv << %Q[ #{name}="#{h self.send(name)}"]
|
||||
if __send__(name)
|
||||
rv << %Q[ #{name}="#{h __send__(name)}"]
|
||||
end
|
||||
end
|
||||
rv << %Q[?>]
|
||||
|
|
|
@ -15,10 +15,10 @@ module RSS
|
|||
module Assertions
|
||||
|
||||
def assert_parse(rss, assert_method, *args)
|
||||
send("assert_#{assert_method}", *args) do
|
||||
__send__("assert_#{assert_method}", *args) do
|
||||
::RSS::Parser.parse(rss)
|
||||
end
|
||||
send("assert_#{assert_method}", *args) do
|
||||
__send__("assert_#{assert_method}", *args) do
|
||||
::RSS::Parser.parse(rss, false).validate
|
||||
end
|
||||
end
|
||||
|
@ -119,7 +119,7 @@ module RSS
|
|||
_wrap_assertion do
|
||||
n_attrs = normalized_attrs(attrs)
|
||||
::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
|
||||
|
|
|
@ -28,7 +28,7 @@ module RSS
|
|||
xmldecl = doc.xml_decl
|
||||
|
||||
%w(version encoding).each do |x|
|
||||
assert_equal(instance_eval(x), xmldecl.send(x))
|
||||
assert_equal(instance_eval(x), xmldecl.__send__(x))
|
||||
end
|
||||
assert_equal(standalone, !xmldecl.standalone.nil?)
|
||||
|
||||
|
@ -69,7 +69,7 @@ module RSS
|
|||
|
||||
channel = RDF::Channel.new(about)
|
||||
%w(title link description image items textinput).each do |x|
|
||||
channel.send("#{x}=", instance_eval(x))
|
||||
channel.__send__("#{x}=", instance_eval(x))
|
||||
end
|
||||
|
||||
doc = REXML::Document.new(make_RDF(channel.to_s))
|
||||
|
@ -187,7 +187,7 @@ module RSS
|
|||
|
||||
image = RDF::Image.new(about)
|
||||
%w(title url link).each do |x|
|
||||
image.send("#{x}=", instance_eval(x))
|
||||
image.__send__("#{x}=", instance_eval(x))
|
||||
end
|
||||
|
||||
doc = REXML::Document.new(make_RDF(image.to_s))
|
||||
|
@ -212,7 +212,7 @@ module RSS
|
|||
|
||||
item = RDF::Item.new(about)
|
||||
%w(title link description).each do |x|
|
||||
item.send("#{x}=", instance_eval(x))
|
||||
item.__send__("#{x}=", instance_eval(x))
|
||||
end
|
||||
|
||||
doc = REXML::Document.new(make_RDF(item.to_s))
|
||||
|
@ -238,7 +238,7 @@ module RSS
|
|||
|
||||
textinput = RDF::Textinput.new(about)
|
||||
%w(title link name description).each do |x|
|
||||
textinput.send("#{x}=", instance_eval(x))
|
||||
textinput.__send__("#{x}=", instance_eval(x))
|
||||
end
|
||||
|
||||
doc = REXML::Document.new(make_RDF(textinput.to_s))
|
||||
|
|
|
@ -61,21 +61,20 @@ EOR
|
|||
@elems.each do |name, value|
|
||||
@parents.each do |parent|
|
||||
meth = "#{RSS::CONTENT_PREFIX}_#{name}"
|
||||
assert_equal(value, @rss.send(parent).funcall(meth))
|
||||
@rss.send(parent).funcall("#{meth}=", new_value[name].to_s)
|
||||
assert_equal(new_value[name], @rss.send(parent).funcall(meth))
|
||||
assert_equal(value, @rss.__send__(parent).funcall(meth))
|
||||
@rss.__send__(parent).funcall("#{meth}=", new_value[name].to_s)
|
||||
assert_equal(new_value[name], @rss.__send__(parent).funcall(meth))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def test_to_s
|
||||
|
||||
@elems.each do |name, value|
|
||||
excepted = "<#{@prefix}:#{name}>#{CGI.escapeHTML(value)}</#{@prefix}:#{name}>"
|
||||
@parents.each do |parent|
|
||||
meth = "#{RSS::CONTENT_PREFIX}_#{name}_element"
|
||||
assert_equal(excepted, @rss.send(parent).funcall(meth))
|
||||
assert_equal(excepted, @rss.__send__(parent).funcall(meth))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ EOR
|
|||
|
||||
@elems.each do |name, value|
|
||||
@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)
|
||||
parsed_value = CGI.escapeHTML(parsed_value)
|
||||
end
|
||||
|
@ -97,16 +97,17 @@ EOR
|
|||
class << t
|
||||
alias_method(:to_s, :iso8601)
|
||||
end
|
||||
@rss.send(parent).send("dc_#{name}=", t.iso8601)
|
||||
assert_equal(t, @rss.send(parent).send("dc_#{name}"))
|
||||
assert_equal(t, @rss.send(parent).date)
|
||||
@rss.__send__(parent).__send__("dc_#{name}=", t.iso8601)
|
||||
assert_equal(t, @rss.__send__(parent).__send__("dc_#{name}"))
|
||||
assert_equal(t, @rss.__send__(parent).date)
|
||||
|
||||
@rss.send(parent).date = value
|
||||
assert_equal(value, @rss.send(parent).date)
|
||||
assert_equal(value, @rss.send(parent).send("dc_#{name}"))
|
||||
@rss.__send__(parent).date = value
|
||||
assert_equal(value, @rss.__send__(parent).date)
|
||||
assert_equal(value, @rss.__send__(parent).__send__("dc_#{name}"))
|
||||
else
|
||||
@rss.send(parent).send("dc_#{name}=", new_value)
|
||||
assert_equal(new_value, @rss.send(parent).send("dc_#{name}"))
|
||||
@rss.__send__(parent).__send__("dc_#{name}=", new_value)
|
||||
assert_equal(new_value,
|
||||
@rss.__send__(parent).__send__("dc_#{name}"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -117,7 +118,7 @@ EOR
|
|||
|
||||
@elems.each do |name, value|
|
||||
@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)
|
||||
parsed_value = CGI.escapeHTML(parsed_value)
|
||||
end
|
||||
|
@ -131,16 +132,21 @@ EOR
|
|||
class << t
|
||||
alias_method(:to_s, :iso8601)
|
||||
end
|
||||
elems = @rss.send(parent).send(plural_reader)
|
||||
elems = @rss.__send__(parent).__send__(plural_reader)
|
||||
elems << klass.new(t.iso8601)
|
||||
values = @rss.send(parent).send(plural_reader).collect{|x| x.value}
|
||||
assert_equal([@rss.send(parent).send("dc_#{name}"), t],
|
||||
new_elems = @rss.__send__(parent).__send__(plural_reader)
|
||||
values = new_elems.collect{|x| x.value}
|
||||
assert_equal([@rss.__send__(parent).__send__("dc_#{name}"), t],
|
||||
values)
|
||||
else
|
||||
elems = @rss.send(parent).send(plural_reader)
|
||||
elems = @rss.__send__(parent).__send__(plural_reader)
|
||||
elems << klass.new(new_value)
|
||||
values = @rss.send(parent).send(plural_reader).collect{|x| x.value}
|
||||
assert_equal([@rss.send(parent).send("dc_#{name}"), new_value],
|
||||
new_elems = @rss.__send__(parent).__send__(plural_reader)
|
||||
values = new_elems.collect{|x| x.value}
|
||||
assert_equal([
|
||||
@rss.__send__(parent).__send__("dc_#{name}"),
|
||||
new_value
|
||||
],
|
||||
values)
|
||||
end
|
||||
end
|
||||
|
@ -151,17 +157,19 @@ EOR
|
|||
@elems.each do |name, value|
|
||||
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
|
||||
@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
|
||||
|
||||
excepted = Array.new(2, excepted).join("\n")
|
||||
@parents.each do |parent|
|
||||
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 = DublinCoreModel.const_get(klass_name)
|
||||
elems << klass.new(@rss.send(parent).send("dc_#{name}"))
|
||||
assert_equal(excepted, @rss.send(parent).funcall("dc_#{name}_elements"))
|
||||
elems << klass.new(@rss.__send__(parent).__send__("dc_#{name}"))
|
||||
assert_equal(excepted,
|
||||
@rss.__send__(parent).funcall("dc_#{name}_elements"))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -86,21 +86,21 @@ EOR
|
|||
%w(size image:size large),
|
||||
%w(image_size image:size medium),
|
||||
].each do |name, full_name, new_value|
|
||||
assert_equal(@favicon_attrs[full_name], favicon.send(name))
|
||||
favicon.send("#{name}=", new_value)
|
||||
assert_equal(new_value, favicon.send(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))
|
||||
favicon.__send__("#{name}=", new_value)
|
||||
assert_equal(new_value, favicon.__send__(name))
|
||||
favicon.__send__("#{name}=", @favicon_attrs[full_name])
|
||||
assert_equal(@favicon_attrs[full_name], favicon.__send__(name))
|
||||
end
|
||||
|
||||
[
|
||||
%w(dc_title dc:title sample-favicon),
|
||||
].each do |name, full_name, new_value|
|
||||
assert_equal(@favicon_contents[full_name], favicon.send(name))
|
||||
favicon.send("#{name}=", new_value)
|
||||
assert_equal(new_value, favicon.send(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))
|
||||
favicon.__send__("#{name}=", new_value)
|
||||
assert_equal(new_value, favicon.__send__(name))
|
||||
favicon.__send__("#{name}=", @favicon_contents[full_name])
|
||||
assert_equal(@favicon_contents[full_name], favicon.__send__(name))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -112,11 +112,11 @@ EOR
|
|||
%w(about rdf:about http://example.com/image.png),
|
||||
%w(resource rdf:resource http://example.com/),
|
||||
].each do |name, full_name, new_value|
|
||||
assert_equal(attrs[full_name], image_item.send(name))
|
||||
image_item.send("#{name}=", new_value)
|
||||
assert_equal(new_value, image_item.send(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))
|
||||
image_item.__send__("#{name}=", new_value)
|
||||
assert_equal(new_value, image_item.__send__(name))
|
||||
image_item.__send__("#{name}=", attrs[full_name])
|
||||
assert_equal(attrs[full_name], image_item.__send__(name))
|
||||
end
|
||||
|
||||
[
|
||||
|
@ -126,11 +126,11 @@ EOR
|
|||
["image_height", "image:height", 88],
|
||||
["dc_title", "dc:title", "sample-image"],
|
||||
].each do |name, full_name, new_value|
|
||||
assert_equal(contents[full_name], image_item.send(name))
|
||||
image_item.send("#{name}=", new_value)
|
||||
assert_equal(new_value, image_item.send(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))
|
||||
image_item.__send__("#{name}=", new_value)
|
||||
assert_equal(new_value, image_item.__send__(name))
|
||||
image_item.__send__("#{name}=", contents[full_name])
|
||||
assert_equal(contents[full_name], image_item.__send__(name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,16 +74,17 @@ EOR
|
|||
|
||||
@elems.each do |name, value|
|
||||
@parents.each do |parent|
|
||||
assert_equal(value, @rss.send(parent).funcall("sy_#{name}"))
|
||||
@rss.send(parent).funcall("sy_#{name}=", new_value[name].to_s)
|
||||
assert_equal(new_value[name], @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)
|
||||
assert_equal(new_value[name],
|
||||
@rss.__send__(parent).funcall("sy_#{name}"))
|
||||
end
|
||||
end
|
||||
|
||||
%w(hourly daily weekly monthly yearly).each do |x|
|
||||
@parents.each do |parent|
|
||||
assert_nothing_raised do
|
||||
@rss.send(parent).sy_updatePeriod = x
|
||||
@rss.__send__(parent).sy_updatePeriod = x
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -91,7 +92,7 @@ EOR
|
|||
%w(-2 0.3 -0.4).each do |x|
|
||||
@parents.each do |parent|
|
||||
assert_not_available_value("updateBase", x) do
|
||||
@rss.send(parent).sy_updateBase = x
|
||||
@rss.__send__(parent).sy_updateBase = x
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -103,7 +104,8 @@ EOR
|
|||
@elems.each do |name, value|
|
||||
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
|
||||
@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
|
||||
|
||||
|
|
|
@ -88,20 +88,20 @@ EOR
|
|||
@elems.each do |name, value|
|
||||
@parents.each do |parent|
|
||||
accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}"
|
||||
target = @rss.send(parent)
|
||||
target20 = @rss20.channel.send(parent, -1)
|
||||
assert_equal(value, target.send(accessor))
|
||||
assert_equal(value, target20.send(accessor))
|
||||
target = @rss.__send__(parent)
|
||||
target20 = @rss20.channel.__send__(parent, -1)
|
||||
assert_equal(value, target.__send__(accessor))
|
||||
assert_equal(value, target20.__send__(accessor))
|
||||
if name == :about
|
||||
# abount is zero or more
|
||||
target.send("#{accessor}=", 0, new_value[name].to_s)
|
||||
target20.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)
|
||||
else
|
||||
target.send("#{accessor}=", new_value[name].to_s)
|
||||
target20.send("#{accessor}=", new_value[name].to_s)
|
||||
target.__send__("#{accessor}=", new_value[name].to_s)
|
||||
target20.__send__("#{accessor}=", new_value[name].to_s)
|
||||
end
|
||||
assert_equal(new_value[name], target.send(accessor))
|
||||
assert_equal(new_value[name], target20.send(accessor))
|
||||
assert_equal(new_value[name], target.__send__(accessor))
|
||||
assert_equal(new_value[name], target20.__send__(accessor))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -114,7 +114,7 @@ EOR
|
|||
@parents.each do |parent|
|
||||
meth = "#{RSS::TRACKBACK_PREFIX}_#{name}_element"
|
||||
meth << "s" if name == :about
|
||||
assert_equal(excepted, @rss.send(parent).funcall(meth))
|
||||
assert_equal(excepted, @rss.__send__(parent).funcall(meth))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue