1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss/taxonomy.rb: changed class or module prefix to

Taxonomy from Taxo.
* lib/rss/maker/taxonomy.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2005-11-23 09:32:22 +00:00
parent 4ef7ec62ca
commit d32f46ad4b
3 changed files with 40 additions and 34 deletions

View file

@ -1,3 +1,9 @@
Wed Nov 23 18:26:00 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/taxonomy.rb: changed class or module prefix to
Taxonomy from Taxo.
* lib/rss/maker/taxonomy.rb: ditto.
Wed Nov 23 18:21:11 2005 Kouhei Sutou <kou@cozmixng.org> Wed Nov 23 18:21:11 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/maker/taxonomy.rb: implemented taxonomy module for RSS * lib/rss/maker/taxonomy.rb: implemented taxonomy module for RSS

View file

@ -4,7 +4,7 @@ require 'rss/maker/dublincore'
module RSS module RSS
module Maker module Maker
module TaxoTopicsModel module TaxonomyTopicsModel
def self.append_features(klass) def self.append_features(klass)
super super
@ -13,7 +13,7 @@ module RSS
klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1) klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
attr_reader :taxo_topics attr_reader :taxo_topics
def make_taxo_topics def make_taxo_topics
self.class::TaxoTopics.new(@maker) self.class::TaxonomyTopics.new(@maker)
end end
def setup_taxo_topics(rss, current) def setup_taxo_topics(rss, current)
@ -24,10 +24,10 @@ EOC
def self.install_taxo_topics(klass) def self.install_taxo_topics(klass)
klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1)) klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1))
class TaxoTopics < TaxoTopicsBase class TaxonomyTopics < TaxonomyTopicsBase
def to_rss(rss, current) def to_rss(rss, current)
if current.respond_to?(:taxo_topics) if current.respond_to?(:taxo_topics)
topics = current.class::TaxoTopics.new topics = current.class::TaxonomyTopics.new
bag = topics.Bag bag = topics.Bag
@resources.each do |resource| @resources.each do |resource|
bag.lis << RDF::Bag::Li.new(resource) bag.lis << RDF::Bag::Li.new(resource)
@ -39,7 +39,7 @@ EOC
EOC EOC
end end
class TaxoTopicsBase class TaxonomyTopicsBase
include Base include Base
attr_reader :resources attr_reader :resources
@ -47,7 +47,7 @@ EOC
end end
end end
module TaxoTopicModel module TaxonomyTopicModel
def self.append_features(klass) def self.append_features(klass)
super super
@ -56,7 +56,7 @@ EOC
klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1) klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
attr_reader :taxo_topics attr_reader :taxo_topics
def make_taxo_topics def make_taxo_topics
self.class::TaxoTopics.new(@maker) self.class::TaxonomyTopics.new(@maker)
end end
def setup_taxo_topics(rss, current) def setup_taxo_topics(rss, current)
@ -68,7 +68,7 @@ EOC
end end
def taxo_topic=(new_value) def taxo_topic=(new_value)
@taxo_topic[0] = self.class::TaxoTopic.new(self) @taxo_topic[0] = self.class::TaxonomyTopic.new(self)
@taxo_topic[0].value = new_value @taxo_topic[0].value = new_value
end end
EOC EOC
@ -76,14 +76,14 @@ EOC
def self.install_taxo_topic(klass) def self.install_taxo_topic(klass)
klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1)) klass.module_eval(<<-EOC, *Utils.get_file_and_line_from_caller(1))
class TaxoTopics < TaxoTopicsBase class TaxonomyTopics < TaxonomyTopicsBase
class TaxoTopic < TaxoTopicBase class TaxonomyTopic < TaxonomyTopicBase
DublinCoreModel.install_dublin_core(self) DublinCoreModel.install_dublin_core(self)
TaxoTopicsModel.install_taxo_topics(self) TaxonomyTopicsModel.install_taxo_topics(self)
def to_rss(rss, current) def to_rss(rss, current)
if current.respond_to?(:taxo_topics) if current.respond_to?(:taxo_topics)
topic = current.class::TaxoTopic.new(value) topic = current.class::TaxonomyTopic.new(value)
topic.taxo_link = value topic.taxo_link = value
taxo_topics.to_rss(rss, topic) if taxo_topics taxo_topics.to_rss(rss, topic) if taxo_topics
current.taxo_topics << topic current.taxo_topics << topic
@ -99,13 +99,13 @@ EOC
EOC EOC
end end
class TaxoTopicsBase class TaxonomyTopicsBase
include Base include Base
def_array_element("taxo_topics") def_array_element("taxo_topics")
def new_taxo_topic def new_taxo_topic
taxo_topic = self.class::TaxoTopic.new(self) taxo_topic = self.class::TaxonomyTopic.new(self)
@taxo_topics << taxo_topic @taxo_topics << taxo_topic
taxo_topic taxo_topic
end end
@ -116,10 +116,10 @@ EOC
end end
end end
class TaxoTopicBase class TaxonomyTopicBase
include Base include Base
include DublinCoreModel include DublinCoreModel
include TaxoTopicsModel include TaxonomyTopicsModel
attr_accessor :value attr_accessor :value
add_need_initialize_variable("value") add_need_initialize_variable("value")
@ -134,43 +134,43 @@ EOC
end end
class RSSBase class RSSBase
include TaxoTopicModel include TaxonomyTopicModel
end end
class ChannelBase class ChannelBase
include TaxoTopicsModel include TaxonomyTopicsModel
end end
class ItemsBase class ItemsBase
class ItemBase class ItemBase
include TaxoTopicsModel include TaxonomyTopicsModel
end end
end end
class RSS10 class RSS10
TaxoTopicModel.install_taxo_topic(self) TaxonomyTopicModel.install_taxo_topic(self)
class Channel class Channel
TaxoTopicsModel.install_taxo_topics(self) TaxonomyTopicsModel.install_taxo_topics(self)
end end
class Items class Items
class Item class Item
TaxoTopicsModel.install_taxo_topics(self) TaxonomyTopicsModel.install_taxo_topics(self)
end end
end end
end end
class RSS09 class RSS09
TaxoTopicModel.install_taxo_topic(self) TaxonomyTopicModel.install_taxo_topic(self)
class Channel class Channel
TaxoTopicsModel.install_taxo_topics(self) TaxonomyTopicsModel.install_taxo_topics(self)
end end
class Items class Items
class Item class Item
TaxoTopicsModel.install_taxo_topics(self) TaxonomyTopicsModel.install_taxo_topics(self)
end end
end end
end end

View file

@ -18,11 +18,11 @@ module RSS
%w(topic topics).each do |name| %w(topic topics).each do |name|
class_name = Utils.to_class_name(name) class_name = Utils.to_class_name(name)
BaseListener.install_class_name(TAXO_URI, name, "Taxo#{class_name}") BaseListener.install_class_name(TAXO_URI, name, "Taxonomy#{class_name}")
TAXO_ELEMENTS << "#{TAXO_PREFIX}_#{name}" TAXO_ELEMENTS << "#{TAXO_PREFIX}_#{name}"
end end
module TaxoTopicsModel module TaxonomyTopicsModel
extend BaseModel extend BaseModel
def self.append_features(klass) def self.append_features(klass)
@ -47,7 +47,7 @@ module RSS
end end
end end
class TaxoTopics < Element class TaxonomyTopics < Element
include RSS10 include RSS10
Bag = ::RSS::RDF::Bag Bag = ::RSS::RDF::Bag
@ -117,7 +117,7 @@ module RSS
end end
end end
module TaxoTopicModel module TaxonomyTopicModel
extend BaseModel extend BaseModel
def self.append_features(klass) def self.append_features(klass)
@ -134,11 +134,11 @@ module RSS
end end
end end
class TaxoTopic < Element class TaxonomyTopic < Element
include RSS10 include RSS10
include DublinCoreModel include DublinCoreModel
include TaxoTopicsModel include TaxonomyTopicsModel
class << self class << self
def required_prefix def required_prefix
@ -212,10 +212,10 @@ module RSS
end end
class RDF class RDF
include TaxoTopicModel include TaxonomyTopicModel
class Channel class Channel
include TaxoTopicsModel include TaxonomyTopicsModel
end end
class Item; include TaxoTopicsModel; end class Item; include TaxonomyTopicsModel; end
end end
end end