diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-18 13:42:43 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-18 13:42:43 +0000 |
commit | 63c3fd6aa25a2dfc5742d40a646be1b55912117c (patch) | |
tree | 8596d82427401ab6e1b398e52368445cc1c79a5e /lib/rss/0.9.rb | |
parent | e6037e61111921169bd8c937e489bd64dccaedb7 (diff) |
* lib/rss/rss.rb: RSS::Element#initialize accepts initial
attributes.
* lib/rss/0.9.rb: ditto.
* lib/rss/1.0.rb: ditto.
* lib/rss/2.0.rb: ditto.
* lib/rss/dublincore.rb: ditto.
* lib/rss/image.rb: ditto.
* lib/rss/taxonomy.rb: ditto.
* lib/rss/trackback.rb: ditto.
* lib/rss/utils.rb: added Utils.element_initialize_arguments? to
detect backward compatibility initial arguments.
* lib/rss/parser.rb: user initial attributes to initialize
RSS::Element.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/0.9.rb')
-rw-r--r-- | lib/rss/0.9.rb | 117 |
1 files changed, 72 insertions, 45 deletions
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index a5009f59ec..f614eff0c8 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -149,10 +149,6 @@ module RSS install_model(name, occurs) end - def initialize() - super() - end - def to_s(need_convert=true, indent='') rv = tag(indent) do |next_indent| [ @@ -274,9 +270,13 @@ module RSS content_setup - def initialize(content=nil) - super() - self.content = content + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.content = args[0] + end end end @@ -319,9 +319,13 @@ module RSS content_setup(:integer) - def initialize(content=nil) - super() - self.content = content + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.content = args[0] + end end end @@ -344,15 +348,18 @@ module RSS install_model(name, "?") end - def initialize(url=nil, title=nil, link=nil, width=nil, height=nil, - description=nil) - super() - self.url = url - self.title = title - self.link = link - self.width = width - self.height = height - self.description = description + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.url = args[0] + self.title = args[1] + self.link = args[2] + self.width = args[3] + self.height = args[4] + self.description = args[5] + end end def to_s(need_convert=true, indent='') @@ -399,13 +406,17 @@ module RSS install_get_attribute(name, uri, required, type) end - def initialize(domain=nil, port=nil, path=nil, rp=nil, protocol=nil) - super() - self.domain = domain - self.port = port - self.path = path - self.registerProcedure = rp - self.protocol = protocol + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.domain = args[0] + self.port = args[1] + self.path = args[2] + self.registerProcedure = args[3] + self.protocol = args[4] + end end def to_s(need_convert=true, indent='') @@ -514,10 +525,14 @@ module RSS content_setup - def initialize(url=nil, content=nil) - super() - self.url = url - self.content = content + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.url = args[0] + self.content = args[1] + end end private @@ -554,11 +569,15 @@ module RSS install_get_attribute(name, uri, required, type) end - def initialize(url=nil, length=nil, type=nil) - super() - self.url = url - self.length = length - self.type = type + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.url = args[0] + self.length = args[1] + self.type = args[2] + end end def to_s(need_convert=true, indent='') @@ -599,10 +618,14 @@ module RSS content_setup - def initialize(domain=nil, content=nil) - super() - self.domain = domain - self.content = content + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.domain = args[0] + self.content = args[1] + end end private @@ -634,12 +657,16 @@ module RSS install_model(name, nil) end - def initialize(title=nil, description=nil, name=nil, link=nil) - super() - self.title = title - self.description = description - self.name = name - self.link = link + def initialize(*args) + if Utils.element_initialize_arguments?(args) + super + else + super() + self.title = args[0] + self.description = args[1] + self.name = args[2] + self.link = args[3] + end end def to_s(need_convert=true, indent='') |