Module: FastGettext::TranslationRepository

Extended by:
TranslationRepository
Included in:
TranslationRepository
Defined in:
lib/fast_gettext/translation_repository.rb,
lib/fast_gettext/translation_repository/db.rb,
lib/fast_gettext/translation_repository/mo.rb,
lib/fast_gettext/translation_repository/po.rb,
lib/fast_gettext/translation_repository/base.rb,
lib/fast_gettext/translation_repository/yaml.rb,
lib/fast_gettext/translation_repository/chain.rb,
lib/fast_gettext/translation_repository/logger.rb,
lib/fast_gettext/translation_repository/db_models/translation_key.rb,
lib/fast_gettext/translation_repository/db_models/translation_text.rb

Overview

Responsibility:

- decide which repository to choose from given input

Defined Under Namespace

Modules: DbModels Classes: Base, Chain, Db, Logger, Mo, Po, Yaml

Instance Method Summary collapse

Instance Method Details

#build(name, options) ⇒ Object

only single-word types supported atm (mytype works, MyType will not)



8
9
10
11
12
13
14
15
# File 'lib/fast_gettext/translation_repository.rb', line 8

def build(name, options)
  type = options[:type] || :mo
  class_name = type.to_s.capitalize
  unless FastGettext::TranslationRepository.constants.map{|c|c.to_s}.include?(class_name)
    require "fast_gettext/translation_repository/#{type}" 
  end
  eval(class_name).new(name,options)
end