mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rss/parser.rb (RSS::ListenerMixin#known_class): define to
work with ruby 1.8.x too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
94031b9628
commit
1695dd0f02
2 changed files with 20 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Jun 29 17:44:23 2008 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rss/parser.rb (RSS::ListenerMixin#known_class): define to
|
||||
work with ruby 1.8.x too.
|
||||
|
||||
Sun Jun 29 17:41:42 2008 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rss/maker/base.rb (RSS::Maker::RSSBase#to_feed): raise
|
||||
|
|
|
@ -361,9 +361,7 @@ module RSS
|
|||
def start_else_element(local, prefix, attrs, ns)
|
||||
class_name = self.class.class_name(_ns(ns, prefix), local)
|
||||
current_class = @last_element.class
|
||||
if class_name and
|
||||
(current_class.const_defined?(class_name, false) or
|
||||
current_class.constants.include?(class_name.to_sym))
|
||||
if known_class?(current_class, class_name)
|
||||
next_class = current_class.const_get(class_name)
|
||||
start_have_something_element(local, prefix, attrs, ns, next_class)
|
||||
else
|
||||
|
@ -379,6 +377,20 @@ module RSS
|
|||
end
|
||||
end
|
||||
|
||||
if Module.method(:const_defined?).arity == -1
|
||||
def known_class?(target_class, class_name)
|
||||
class_name and
|
||||
(target_class.const_defined?(class_name, false) or
|
||||
target_class.constants.include?(class_name.to_sym))
|
||||
end
|
||||
else
|
||||
def known_class?(target_class, class_name)
|
||||
class_name and
|
||||
(target_class.const_defined?(class_name) or
|
||||
target_class.constants.include?(class_name))
|
||||
end
|
||||
end
|
||||
|
||||
NAMESPLIT = /^(?:([\w:][-\w\d.]*):)?([\w:][-\w\d.]*)/
|
||||
def split_name(name)
|
||||
name =~ NAMESPLIT
|
||||
|
|
Loading…
Reference in a new issue