Module: FeedNormalizer::Singular

### Home Classes Methods

### In Files

- lib/structures.rb

### Methods

- #method_missing
- #respond_to?

### 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::Singular

### Public Instance Methods

method_missing(name, *args) click to toggle source

If the method being called is a singular (in this simple case, does not end with an 's'), then it calls the plural method, and calls the first element. We're assuming that plural methods provide an array.

Example: Object contains an array called 'alphas', which looks like [:a, :b, :c]. Call object.alpha and :a is returned.

    # File lib/structures.rb, line 13
    def method_missing(name, *args)
      return self.send(:"#{name}s").first rescue super(name, *args)
    end

respond_to?(x, y=false) click to toggle source

    # File lib/structures.rb, line 17
    def respond_to?(x, y=false)
      self.class::ELEMENTS.include?(x) || self.class::ELEMENTS.include?(:"#{x}s") || super(x, y)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.