method
tag
tag(indent, additional_attrs={}, &block)
private
Hide source
# File lib/rss/rss.rb, line 674 def tag(indent, additional_attrs={}, &block) next_indent = indent + INDENT attrs = collect_attrs return "" if attrs.nil? attrs.update(additional_attrs) start_tag = make_start_tag(indent, next_indent, attrs) if block content = block.call(next_indent) else content = [] end if content.is_a?(String) content = [content] start_tag << ">" end_tag = "</#{full_name}>" else content = content.reject{|x| x.empty?} if content.empty? end_tag = "/>" else start_tag << ">\n" end_tag = "\n#{indent}</#{full_name}>" end end start_tag + content.join("\n") + end_tag end