aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-27 04:45:24 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-27 04:45:24 +0000
commit4365f6710d42c17152e94c40e9ce349d96b5c057 (patch)
tree02c2c63c8882c66f63cf31657f128f0142d1e21b
parent23c14c361377e15d875cd059df07190bfbde2c79 (diff)
downloadruby-4365f6710d42c17152e94c40e9ce349d96b5c057.tar.gz
* NEWS, lib/rss/maker/base.rb, test/rss/test_maker_2.0.rb: add
item.guid.permanent_link? and item.guid.permanent_link=. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--NEWS5
-rw-r--r--lib/rss/maker/base.rb8
-rw-r--r--test/rss/test_maker_2.0.rb20
4 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 75ca650318..3c2dc8b737 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jun 27 13:44:48 2009 Kouhei Sutou <kou@cozmixng.org>
+
+ * NEWS, lib/rss/maker/base.rb, test/rss/test_maker_2.0.rb: add
+ item.guid.permanent_link? and item.guid.permanent_link=.
+
Sat Jun 27 13:41:00 2009 Kouhei Sutou <kou@cozmixng.org>
* NEWS: rss: 0.2.5 -> 0.2.7.
diff --git a/NEWS b/NEWS
index 7ea63ff7af..83f10ff1e0 100644
--- a/NEWS
+++ b/NEWS
@@ -84,6 +84,11 @@ with all sufficient information, see the ChangeLog file.
* RSS::Maker.supported?(version)
* new method to check whether given version is supported.
+ * RSS::Maker: item.guid.permanent_link?
+ * new alias of item.guid.isPermaLink
+ * RSS::Maker: item.guid.permanent_link=
+ * new alias of item.guid.isPermaLink=
+
* REXML
* REXML::Document.entity_expansion_limit=
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index 6b42f11fcb..9ccfba7e84 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -746,6 +746,14 @@ module RSS
attr_accessor element
add_need_initialize_variable(element)
end
+
+ def permanent_link?
+ isPermaLink
+ end
+
+ def permanent_link=(bool)
+ self.isPermaLink = bool
+ end
end
class EnclosureBase < Base
diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb
index 6321ea5dce..d4d9832373 100644
--- a/test/rss/test_maker_2.0.rb
+++ b/test/rss/test_maker_2.0.rb
@@ -488,6 +488,26 @@ module RSS
assert_equal(content, guid.content)
end
+ def test_guid_permanent_link
+ content = "http://inessential.com/2002/09/01.php#a2"
+
+ rss = RSS::Maker.make("2.0") do |maker|
+ setup_dummy_channel(maker)
+ setup_dummy_item(maker)
+
+ guid = maker.items.last.guid
+ assert_equal(nil, guid.permanent_link?)
+ assert_equal(guid.isPermaLink, guid.permanent_link?)
+ guid.permanent_link = true
+ assert_equal(true, guid.permanent_link?)
+ assert_equal(guid.isPermaLink, guid.permanent_link?)
+ guid.content = content
+ end
+ guid = rss.channel.items.last.guid
+ assert_equal(true, guid.isPermaLink)
+ assert_equal(content, guid.content)
+ end
+
def test_not_valid_guid
content = "http://inessential.com/2002/09/01.php#a2"