Module: FeedNormalizer::ElementCleaner

### Home Classes Methods

### In Files

- lib/structures.rb

### Methods

- #clean!

### Files

- History.txt
- License.txt
- Manifest.txt
- README.txt

### Class/Module Index

Quicksearch

- FeedNormalizer
- FeedNormalizer::ElementCleaner
- FeedNormalizer::ElementEquality
- FeedNormalizer::Entry
- FeedNormalizer::Feed
- FeedNormalizer::FeedNormalizer
- FeedNormalizer::HtmlCleaner
- FeedNormalizer::Parser
- FeedNormalizer::ParserRegistry
- FeedNormalizer::RewriteRelativeLinks
- FeedNormalizer::RubyRssParser
- FeedNormalizer::SimpleRssParser
- FeedNormalizer::Singular
- FeedNormalizer::TimeFix
- RSS
- RSS::Rss
- RSS::Rss::Channel
- RSS::Rss::Channel::Item
- RSS::Rss::Channel::Item::Enclosure
- SimpleRSS

No matching classes.

# FeedNormalizer::ElementCleaner

### Public Instance Methods

clean!() click to toggle source

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.(title|description|content)

    # File lib/structures.rb, line 100
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.