lib/structures.rb
# Recursively cleans all elements in place.
#
# Only allow tags in whitelist. Always parse the html with a parser and delete
# all tags that arent on the list.
#
# For feed elements that can contain HTML:
# - feed.(title|description)
# - feed.entries[n].(title|description|content)
#
Recursively cleans all elements in place.
Only allow tags in whitelist. Always parse the html with a parser and delete
all tags that arent on the list.

For feed elements that can contain HTML:
feed.(title|description)
feed.entries[n].(title|description|content)
Recursively cleans all elements in place . Only allow tags in whitelist . Always parse the html with a parser and delete all tags that arent on the list . For feed elements that can contain HTML : feed . ( title|description ) feed . entries [ n ] . ( title|description|content )
def clean!
      self.class::SIMPLE_ELEMENTS.each do |element|
        val = self.send(element)
        send("#{element}=", (val.is_a?(Array) ?
          val.collect{|v| HtmlCleaner.flatten(v.to_s)} : HtmlCleaner.flatten(val.to_s)))
      end
      self.class::HTML_ELEMENTS.each do |element|
        send("#{element}=", HtmlCleaner.clean(self.send(element).to_s))
      end
      self.class::BLENDED_ELEMENTS.each do |element|
        self.send(element).collect{|v| v.clean!}
      end
    end
def clean! self . class :: SIMPLE_ELEMENTS . each do | element | val = self . send ( element ) send ( "#{element}=" , ( val . is_a? ( Array ) ? val . collect { | v | HtmlCleaner . flatten ( v . to_s ) } : HtmlCleaner . flatten ( val . to_s ) ) ) end self . class :: HTML_ELEMENTS . each do | element | send ( "#{element}=" , HtmlCleaner . clean ( self . send ( element ) . to_s ) ) end self . class :: BLENDED_ELEMENTS . each do | element | self . send ( element ) . collect { | v | v . clean! } end end
Recursively cleans all elements in place.
Recursively cleans all elements in place .