diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-03 07:03:33 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-03 07:03:33 +0000 |
commit | aece192714a532bbace8bb12e958b012f8bb6161 (patch) | |
tree | 815db606a379a4c1e3055ad7f873ef2403d446e4 /lib | |
parent | 5956031818601953ad7cba73b57599eafc89cd78 (diff) | |
download | ruby-aece192714a532bbace8bb12e958b012f8bb6161.tar.gz ruby-aece192714a532bbace8bb12e958b012f8bb6161.tar.xz ruby-aece192714a532bbace8bb12e958b012f8bb6161.zip |
* test/rss/test_maker_*.rb: added tests for RSS Maker.
* lib/rss/maker.rb: added RSS Maker.
* lib/rss/maker/*.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rss/0.9.rb | 10 | ||||
-rw-r--r-- | lib/rss/content.rb | 2 | ||||
-rw-r--r-- | lib/rss/dublincore.rb | 2 | ||||
-rw-r--r-- | lib/rss/rss.rb | 3 | ||||
-rw-r--r-- | lib/rss/syndication.rb | 4 | ||||
-rw-r--r-- | lib/rss/xml-stylesheet.rb | 2 |
6 files changed, 16 insertions, 7 deletions
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index dd5f93b86..c772e8087 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -51,6 +51,14 @@ module RSS end end + def textinput + if @channel + @channel.textInput + else + nil + end + end + def to_s(convert=true, indent=calc_indent) next_indent = indent + INDENT rv = <<-EOR @@ -252,7 +260,7 @@ EOT install_get_attribute(name, uri, required) end - def initialize(domain, port, path, rp, protocol) + def initialize(domain=nil, port=nil, path=nil, rp=nil, protocol=nil) super() @domain = domain @port = port diff --git a/lib/rss/content.rb b/lib/rss/content.rb index 4367d16d9..280bbb8d6 100644 --- a/lib/rss/content.rb +++ b/lib/rss/content.rb @@ -16,7 +16,7 @@ module RSS def self.append_features(klass) super - klass.module_eval(<<-EOC) + klass.module_eval(<<-EOC, *get_file_and_line_from_caller(1)) %w(encoded).each do |x| install_text_element("\#{CONTENT_PREFIX}_\#{x}") end diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb index 417ab5b17..7ea9cf31d 100644 --- a/lib/rss/dublincore.rb +++ b/lib/rss/dublincore.rb @@ -16,7 +16,7 @@ module RSS def self.append_features(klass) super - klass.module_eval(<<-EOC) + klass.module_eval(<<-EOC, *get_file_and_line_from_caller(1)) %w(title description creator subject publisher contributor type format identifier source language relation coverage rights).each do |x| diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 231fb1fb6..b6afa24b9 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -4,6 +4,7 @@ # Author:: Kouhei Sutou <kou@cozmixng.org> # Tutorial:: http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en + require "time" class Time @@ -234,7 +235,7 @@ EOC # Is it need? if @#{name} class << @#{name} - alias_method(:_to_s, :to_s) unless respond_to?(:_to_s) + undef_method(:to_s) alias_method(:to_s, :#{type}) end end diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb index 75f612864..c274ff8c8 100644 --- a/lib/rss/syndication.rb +++ b/lib/rss/syndication.rb @@ -16,7 +16,7 @@ module RSS def self.append_features(klass) super - klass.module_eval(<<-EOC) + klass.module_eval(<<-EOC, *get_file_and_line_from_caller(1)) %w(updatePeriod updateFrequency).each do |x| install_text_element("\#{SY_PREFIX}_\#{x}") end @@ -34,7 +34,6 @@ module RSS alias_method(:_sy_updateFrequency=, :sy_updateFrequency=) def sy_updateFrequency=(new_value) - new_value = new_value.strip validate_sy_updateFrequency(new_value) if @do_validate self._sy_updateFrequency = new_value.to_i end @@ -65,6 +64,7 @@ module RSS SY_UPDATEFREQUENCY_AVAILABLE_RE = /\A\s*\+?\d+\s*\z/ def validate_sy_updateFrequency(value) + value = value.to_s.strip if SY_UPDATEFREQUENCY_AVAILABLE_RE !~ value raise NotAvailableValueError.new("updateFrequency", value) end diff --git a/lib/rss/xml-stylesheet.rb b/lib/rss/xml-stylesheet.rb index 726899ed8..c51c0dc71 100644 --- a/lib/rss/xml-stylesheet.rb +++ b/lib/rss/xml-stylesheet.rb @@ -86,7 +86,7 @@ module RSS private def guess_type(filename) - /\.([^.]+)/ =~ filename + /\.([^.]+)$/ =~ filename GUESS_TABLE[$1] end |