Methods
#
C
D
M
N
Attributes
[R] defaults
Class Public methods
new(*mappings)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/locale/fallbacks.rb, line 57
def initialize(*mappings)
  @map = {}
  map(mappings.pop) if mappings.last.is_a?(Hash)
  self.defaults = mappings.empty? ? [I18n.default_locale.to_sym] : mappings
end
Instance Public methods
[](locale)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/locale/fallbacks.rb, line 68
def [](locale)
  raise InvalidLocale.new(locale) if locale.nil?
  locale = locale.to_sym
  super || store(locale, compute(locale))
end
defaults=(defaults)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/locale/fallbacks.rb, line 63
def defaults=(defaults)
  @defaults = defaults.map { |default| compute(default, false) }.flatten
end
map(mappings)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/locale/fallbacks.rb, line 74
def map(mappings)
  mappings.each do |from, to|
    from, to = from.to_sym, Array(to)
    to.each do |to|
      @map[from] ||= []
      @map[from] << to.to_sym
    end
  end
end
Instance Protected methods
compute(tags, include_defaults = true)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/locale/fallbacks.rb, line 86
def compute(tags, include_defaults = true)
  result = Array(tags).collect do |tag|
    tags = I18n::Locale::Tag.tag(tag).self_and_parents.map! { |t| t.to_sym }
    tags.each { |tag| tags += compute(@map[tag]) if @map[tag] }
    tags
  end.flatten
  result.push(*defaults) if include_defaults
  result.uniq
end