Attributes
Write
No documentation available
Class Methods
::
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 534
def xml_getter
"xml"
end
No documentation available
::
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 530
def xml_setter
"xml="
end
No documentation available
Instance Methods
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 576
def atom_validate(ignore_unknown_element, tags, uri)
if out_of_line?
raise MissingAttributeError.new(tag_name, "type") if @type.nil?
unless (content.nil? or content.empty?)
raise NotAvailableValueError.new(tag_name, content)
end
elsif inline_xhtml?
if @xml.nil?
raise MissingTagError.new("div", tag_name)
end
unless @xml.name == "div" and @xml.uri == XHTML_URI
raise NotExpectedTagError.new(@xml.name, @xml.uri, tag_name)
end
end
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 657
def empty_content?
out_of_line? or super
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 550
def have_xml_content?
inline_xhtml? or inline_other_xml?
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 596
def inline_html?
return false if out_of_line?
@type == "html" or mime_split == ["text", "html"]
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 605
def inline_other?
return false if out_of_line?
media_type, subtype = mime_split
return false if media_type.nil? or subtype.nil?
true
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 635
def inline_other_base64?
inline_other? and !inline_other_text? and !inline_other_xml?
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 612
def inline_other_text?
return false unless inline_other?
return false if inline_other_xml?
media_type, = mime_split
return true if "text" == media_type.downcase
false
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 621
def inline_other_xml?
return false unless inline_other?
media_type, subtype = mime_split
normalized_mime_type = "#{media_type}/#{subtype}".downcase
if /(?:\+xml|^xml)$/ =~ subtype or
%w(text/xml-external-parsed-entity
application/xml-external-parsed-entity
application/xml-dtd).find {|x| x == normalized_mime_type}
return true
end
false
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 592
def inline_text?
!out_of_line? and [nil, "text", "html"].include?(@type)
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 601
def inline_xhtml?
!out_of_line? and @type == "xhtml"
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 643
def mime_split
media_type = subtype = nil
if /\A\s*([a-z]+)\/([a-z\+]+)\s*(?:;.*)?\z/i =~ @type.to_s
media_type = $1.downcase
subtype = $2.downcase
end
[media_type, subtype]
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 652
def need_base64_encode?
inline_other_base64?
end
No documentation available
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 639
def out_of_line?
not @src.nil?
end
No documentation available
#
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 568
def xhtml
if inline_xhtml?
xml
else
nil
end
end
No documentation available
#
lib/rss/atom.rb
View on GitHub
# File tmp/rubies/ruby-2.3.8/lib/rss/atom.rb, line 554
def xml
return @xml unless inline_xhtml?
return @xml if @xml.nil?
if @xml.is_a?(XML::Element) and
[@xml.name, @xml.uri] == ["div", XHTML_URI]
return @xml
end
children = @xml
children = [children] unless children.is_a?(Array)
XML::Element.new("div", nil, XHTML_URI,
{"xmlns" => XHTML_URI}, children)
end
No documentation available