зеркало из https://github.com/github/ruby.git
* lib/rss/1.0.rb: added convenience method 'resources'.
* lib/rss/taxonomy.rb: ditto. * test/rss/rss-assertions.rb: added test for 'resources'. * test/rss/test_taxonomy.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fb1d1a917d
Коммит
02c5d7e79a
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Thu Nov 17 17:58:00 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rss/1.0.rb: added convenience method 'resources'.
|
||||
|
||||
* lib/rss/taxonomy.rb: ditto.
|
||||
|
||||
* test/rss/rss-assertions.rb: added test for 'resources'.
|
||||
|
||||
* test/rss/test_taxonomy.rb: ditto.
|
||||
|
||||
Thu Nov 17 17:53:30 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rss/taxonomy.rb: implemented taxonomy module.
|
||||
|
|
|
@ -438,12 +438,21 @@ module RSS
|
|||
end
|
||||
end
|
||||
|
||||
def resources
|
||||
if @Seq
|
||||
@Seq.lis.collect do |li|
|
||||
li.resource
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def children
|
||||
[@Seq]
|
||||
end
|
||||
|
||||
private
|
||||
def _tags
|
||||
rv = []
|
||||
rv << [URI, 'Seq'] unless @Seq.nil?
|
||||
|
@ -453,9 +462,7 @@ module RSS
|
|||
def rdf_validate(tags)
|
||||
_validate(tags, [["Seq", nil]])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Image < Element
|
||||
|
|
|
@ -86,6 +86,16 @@ module RSS
|
|||
end
|
||||
end
|
||||
|
||||
def resources
|
||||
if @Bag
|
||||
@Bag.lis.collect do |li|
|
||||
li.resource
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def children
|
||||
[@Bag]
|
||||
|
|
|
@ -193,6 +193,7 @@ module RSS
|
|||
|
||||
def assert_channel10_items(attrs, items)
|
||||
_wrap_assertion do
|
||||
assert_equal(items.resources, items.Seq.lis.collect {|x| x.resource})
|
||||
items.Seq.lis.each_with_index do |li, i|
|
||||
assert_attributes(attrs[i], %w(resource), li)
|
||||
end
|
||||
|
|
|
@ -117,6 +117,7 @@ EOR
|
|||
topics = @rss.channel.taxo_topics
|
||||
assert_equal(@topics_lis.sort,
|
||||
topics.Bag.lis.collect {|li| li.resource}.sort)
|
||||
assert_equal(@topics_lis.sort, topics.resources.sort)
|
||||
|
||||
assert_equal(@rss.taxo_topics.first, @rss.taxo_topic)
|
||||
|
||||
|
@ -128,8 +129,7 @@ EOR
|
|||
assert_equal(value, topic.about)
|
||||
assert_equal(value, topic.taxo_link)
|
||||
when :topics
|
||||
assert_equal(value.sort,
|
||||
topic.taxo_topics.Bag.lis.collect {|li| li.resource}.sort)
|
||||
assert_equal(value.sort, topic.taxo_topics.resources.sort)
|
||||
else
|
||||
assert_equal(value, topic.__send__("dc_#{name}"))
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче