class 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
Calls superclass method
FastGettext::TranslationRepository::Base::new
# 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
Calls superclass method
FastGettext::TranslationRepository::Base#reload
# File lib/fast_gettext/translation_repository/chain.rb, line 42 def reload chain.each(&:reload) super end