Class: RSS::Atom::Feed::Entry::Content
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: | |
| Instance Chain: | |
| Inherits: | RSS::Element 
 | 
| Defined in: | lib/rss/atom.rb | 
Overview
Contains or links to the content of the ::RSS::Atom::Feed::Entry. It has the following attributes:
- 
type 
- 
src 
Reference: validator.w3.org/feed/docs/rfc4287.html#element.content
Constant Summary
::RSS::Element - Inherited
GET_ATTRIBUTES, HAVE_CHILDREN_ELEMENTS, INDENT, MODELS, MUST_CALL_VALIDATORS, NEED_INITIALIZE_VARIABLES, PLURAL_FORMS, TO_ELEMENT_METHODS
::RSS::Atom::CommonModel - Included
Class Attribute Summary
::RSS::Element - Inherited
Class Method Summary
::RSS::Element - Inherited
::RSS::Utils::InheritedReader - Extended
::RSS::BaseModel - Extended
::RSS::Utils - Included
| element_initialize_arguments? | This method is used inside of several different objects to determine if special behavior is needed in the constructor. | 
| get_file_and_line_from_caller | Returns an array of two elements: the filename where the calling method is located, and the line number where it is defined. | 
| h, | |
| html_escape | Takes a string  | 
| new_with_value_if_need | If  | 
| to_class_name | Given a  | 
Instance Attribute Summary
- 
    
      #have_xml_content?  ⇒ Boolean 
    
    readonly
    Returns true if the element has inline ::RSS::XML content. 
- 
    
      #inline_html?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a HTML media type. 
- 
    
      #inline_other?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a MIME media type. 
- 
    
      #inline_other_base64?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content encoded in base64. 
- 
    
      #inline_other_text?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a text media type. 
- 
    
      #inline_other_xml?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a ::RSS::XML media type. 
- 
    
      #inline_text?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a text or HTML media type, or no media type at all. 
- 
    
      #inline_xhtml?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains inline content that has a XHTML media type. 
- 
    
      #need_base64_encode?  ⇒ Boolean 
    
    readonly
    Returns true if the content needs to be encoded in base64. 
- 
    
      #out_of_line?  ⇒ Boolean 
    
    readonly
    Returns true if the element contains linked content. 
- 
    
      #xml  
    
    rw
    Returns or builds the element content in ::RSS::XML. 
- 
    
      #xml=(value)  
    
    rw
    Returns the element content in ::RSS::XML. 
- #empty_content? ⇒ Boolean readonly private
::RSS::Element - Inherited
Instance Method Summary
- 
    
      #atom_validate(ignore_unknown_element, tags, uri)  
    
    Raises a ::RSS::MissingAttributeError, ::RSS::NotAvailableValueError, ::RSS::MissingTagError or ::RSS::NotExpectedTagError if the element is not properly formatted. 
- 
    
      #mime_split  
    
    Splits the type attribute into an array, e.g. 
- 
    
      #xhtml  
    
    Returns the element content in XHTML. 
::RSS::Element - Inherited
::RSS::SetupMaker - Included
| #setup_maker, #maker_target, #not_need_to_call_setup_maker_variables, #setup_maker_attributes, #setup_maker_element, #setup_maker_elements | 
::RSS::Utils - Included
| #element_initialize_arguments? | This method is used inside of several different objects to determine if special behavior is needed in the constructor. | 
| #get_file_and_line_from_caller | Returns an array of two elements: the filename where the calling method is located, and the line number where it is defined. | 
| #h, | |
| #html_escape | Takes a string  | 
| #new_with_value_if_need | If  | 
| #to_class_name | Given a  | 
Constructor Details
This class inherits a constructor from RSS::Element
Class Method Details
.xml_getter
[ GitHub ]# File 'lib/rss/atom.rb', line 620
def xml_getter "xml" end
.xml_setter
[ GitHub ]# File 'lib/rss/atom.rb', line 616
def xml_setter "xml=" end
Instance Attribute Details
    #empty_content?  ⇒ Boolean  (readonly, private)
  
  [ GitHub ]
# File 'lib/rss/atom.rb', line 768
def empty_content? out_of_line? or super end
    #have_xml_content?  ⇒ Boolean  (readonly)
  
Returns true if the element has inline ::RSS::XML content.
# File 'lib/rss/atom.rb', line 639
def have_xml_content? inline_xhtml? or inline_other_xml? end
    #inline_html?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a HTML media type.
# File 'lib/rss/atom.rb', line 694
def inline_html? return false if out_of_line? @type == "html" or mime_split == ["text", "html"] end
    #inline_other?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a MIME media type.
# File 'lib/rss/atom.rb', line 707
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
    #inline_other_base64?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content encoded in base64.
# File 'lib/rss/atom.rb', line 743
def inline_other_base64? inline_other? and !inline_other_text? and !inline_other_xml? end
    #inline_other_text?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a text media type.
# File 'lib/rss/atom.rb', line 716
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
    #inline_other_xml?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a ::RSS::XML media type.
# File 'lib/rss/atom.rb', line 727
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
    #inline_text?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a text or HTML media type, or no media type at all.
# File 'lib/rss/atom.rb', line 688
def inline_text? !out_of_line? and [nil, "text", "html"].include?(@type) end
    #inline_xhtml?  ⇒ Boolean  (readonly)
  
Returns true if the element contains inline content that has a XHTML media type.
# File 'lib/rss/atom.rb', line 701
def inline_xhtml? !out_of_line? and @type == "xhtml" end
    #need_base64_encode?  ⇒ Boolean  (readonly)
  
Returns true if the content needs to be encoded in base64.
# File 'lib/rss/atom.rb', line 763
def need_base64_encode? inline_other_base64? end
    #out_of_line?  ⇒ Boolean  (readonly)
  
Returns true if the element contains linked content.
# File 'lib/rss/atom.rb', line 748
def out_of_line? not @src.nil? end
#xml (rw)
Returns or builds the element content in ::RSS::XML.
# File 'lib/rss/atom.rb', line 644
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
#xml=(value) (rw)
Returns the element content in ::RSS::XML.
# File 'lib/rss/atom.rb', line 636
attr_writer :xml
Instance Method Details
#atom_validate(ignore_unknown_element, tags, uri)
Raises a ::RSS::MissingAttributeError, ::RSS::NotAvailableValueError, ::RSS::MissingTagError or ::RSS::NotExpectedTagError if the element is not properly formatted.
# File 'lib/rss/atom.rb', line 670
def atom_validate(ignore_unknown_element, , 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
#mime_split
Splits the type attribute into an array, e.g. [“text”, “xml”]
# File 'lib/rss/atom.rb', line 753
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
  #xhtml
Returns the element content in XHTML.
# File 'lib/rss/atom.rb', line 659
def xhtml if inline_xhtml? xml else nil end end