Class: FastGettext::TranslationRepository::Chain

### Home Classes Methods

### In Files

- lib/fast_gettext/translation_repository/chain.rb

### Parent

FastGettext::TranslationRepository::Base

### Methods

- ::new
- #[]
- #available_locales
- #plural
- #pluralisation_rule
- #reload

### Class/Module Index

Quicksearch

- FastGettext
- FastGettext::Cache
- FastGettext::GetText
- FastGettext::GetText::MOFile
- FastGettext::GetText::MOFile::HeaderRev1
- FastGettext::GetText::MOFile::InvalidFormat
- FastGettext::GetText::PoParser
- FastGettext::MoFile
- FastGettext::PoFile
- FastGettext::Storage
- FastGettext::Storage::NoTextDomainConfigured
- FastGettext::Translation
- FastGettext::TranslationMultidomain
- FastGettext::TranslationRepository
- FastGettext::TranslationRepository::Base
- FastGettext::TranslationRepository::Chain
- FastGettext::TranslationRepository::Db
- FastGettext::TranslationRepository::Logger
- FastGettext::TranslationRepository::Mo
- FastGettext::TranslationRepository::Po
- FastGettext::TranslationRepository::Yaml
- String
- TranslationKey
- TranslationText

No matching classes.

# FastGettext::TranslationRepository::Chain

    Responsibility:
     - delegate calls to members of the chain in turn

TODO cache should be expired after a repo was added

### Attributes

chain[RW]

### Public Class Methods

new(name,options={}) click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 11
    def initialize(name,options={})
      super
      self.chain = options[:chain]
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 27
    def [](key)
      chain.each do |c|
        result = c[key] and return result
      end
      nil
    end

available_locales() click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 16
    def available_locales
      chain.map{|c|c.available_locales}.flatten.uniq
    end

plural(*keys) click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 34
    def plural(*keys)
      chain.each do |c|
        result = c.plural(*keys)
        return result unless result.compact.empty?
      end
      []
    end

pluralisation_rule() click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 20
    def pluralisation_rule
      chain.each do |c|
        result = c.pluralisation_rule and return result
      end
      nil
    end

reload() click to toggle source

    # File lib/fast_gettext/translation_repository/chain.rb, line 42
    def reload
      chain.each(&:reload)
      super
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.