From d3f1204ede7ef4acd62bdca967aff8d7c929e907 Mon Sep 17 00:00:00 2001 From: kou Date: Tue, 15 Nov 2005 16:31:31 +0000 Subject: [PATCH] * lib/rss/trackback.rb: added TrackBack prefix. * lib/rss/maker/trackback.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/rss/maker/trackback.rb | 14 +++++++------- lib/rss/trackback.rb | 30 ++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78ed8abd7d..0eeb399014 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Nov 16 01:29:31 2005 Kouhei Sutou + + * lib/rss/trackback.rb: added TrackBack prefix. + + * lib/rss/maker/trackback.rb: ditto. + Wed Nov 16 01:26:13 2005 Kouhei Sutou * lib/rss/rss.rb (RSS::VERSION): 0.1.5 -> 0.1.6. diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb index b334079582..32254a040c 100644 --- a/lib/rss/maker/trackback.rb +++ b/lib/rss/maker/trackback.rb @@ -41,7 +41,7 @@ module RSS def_array_element("abouts") def new_about - about = self.class::About.new(@maker) + about = self.class::TrackBackAbout.new(@maker) @abouts << about about end @@ -52,7 +52,7 @@ module RSS end end - class AboutBase + class TrackBackAboutBase include Base attr_accessor :value @@ -79,10 +79,10 @@ module RSS class Items class Item class TrackBackAbouts < TrackBackAboutsBase - class About < AboutBase + class TrackBackAbout < TrackBackAboutBase def to_rss(rss, current) if resource - about = ::RSS::TrackBackModel10::About.new(resource) + about = ::RSS::TrackBackModel10::TrackBackAbout.new(resource) current.trackback_abouts << about end end @@ -98,7 +98,7 @@ module RSS class TrackBackAbouts < TrackBackAboutsBase def to_rss(*args) end - class About < AboutBase + class TrackBackAbout < TrackBackAboutBase end end end @@ -109,10 +109,10 @@ module RSS class Items class Item class TrackBackAbouts < TrackBackAboutsBase - class About < AboutBase + class TrackBackAbout < TrackBackAboutBase def to_rss(rss, current) if content - about = ::RSS::TrackBackModel20::About.new(content) + about = ::RSS::TrackBackModel20::TrackBackAbout.new(content) current.trackback_abouts << about end end diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb index 6c083504ae..3a5304a8f4 100644 --- a/lib/rss/trackback.rb +++ b/lib/rss/trackback.rb @@ -34,6 +34,9 @@ module RSS end module BaseTrackBackModel + + ELEMENTS = %w(ping about) + def append_features(klass) super @@ -42,7 +45,7 @@ module RSS %w(ping).each do |name| var_name = "#{TRACKBACK_PREFIX}_#{name}" - klass_name = name.capitalize + klass_name = "TrackBack#{Utils.to_class_name(name)}" klass.install_have_child_element(var_name) klass.module_eval(<<-EOC, __FILE__, __LINE__) remove_method :#{var_name} @@ -59,7 +62,7 @@ module RSS [%w(about s)].each do |name, postfix| var_name = "#{TRACKBACK_PREFIX}_#{name}" - klass_name = name.capitalize + klass_name = "TrackBack#{Utils.to_class_name(name)}" klass.install_have_children_element(var_name) klass.module_eval(<<-EOC, __FILE__, __LINE__) remove_method :#{var_name} @@ -105,7 +108,7 @@ module RSS extend BaseModel extend BaseTrackBackModel - class Ping < Element + class TrackBackPing < Element include RSS10 class << self @@ -119,6 +122,8 @@ module RSS end end + + @tag_name = "ping" [ ["resource", ::RSS::RDF::URI, true] @@ -153,7 +158,7 @@ module RSS end - class About < Element + class TrackBackAbout < Element include RSS10 class << self @@ -168,6 +173,8 @@ module RSS end + @tag_name = "about" + [ ["resource", ::RSS::RDF::URI, true] ].each do |name, uri, required| @@ -214,9 +221,11 @@ module RSS extend BaseModel extend BaseTrackBackModel - class Ping < Element + class TrackBackPing < Element include RSS09 + @tag_name = "ping" + content_setup class << self @@ -245,9 +254,11 @@ module RSS end - class About < Element + class TrackBackAbout < Element include RSS09 + @tag_name = "about" + content_setup class << self @@ -287,4 +298,11 @@ module RSS end end + BaseTrackBackModel::ELEMENTS.each do |name| + class_name = Utils.to_class_name(name) + BaseListener.install_class_name(TRACKBACK_URI, name, + "TrackBack#{class_name}") + end + + BaseTrackBackModel::ELEMENTS.collect! {|name| "#{TRACKBACK_PREFIX}_#{name}"} end