method
collect_attributes
v2_1_10 -
Show latest stable
- Class:
RSS::ListenerMixin
collect_attributes(tag_name, prefix, attrs, ns, klass)private
No documentation available.
# File lib/rss/parser.rb, line 476
def collect_attributes(tag_name, prefix, attrs, ns, klass)
attributes = {}
klass.get_attributes.each do |a_name, a_uri, required, element_name|
if a_uri.is_a?(String) or !a_uri.respond_to?(:include?)
a_uri = [a_uri]
end
unless a_uri == [""]
for prefix, uri in ns
if a_uri.include?(uri)
val = attrs["#{prefix}:#{a_name}"]
break if val
end
end
end
if val.nil? and a_uri.include?("")
val = attrs[a_name]
end
if @do_validate and required and val.nil?
unless a_uri.include?("")
for prefix, uri in ns
if a_uri.include?(uri)
a_name = "#{prefix}:#{a_name}"
end
end
end
raise MissingAttributeError.new(tag_name, a_name)
end
attributes[a_name] = val
end
attributes
end