Sha256: c71e2e408e9d8e967a2bfa61e365d0046296ddfc5486de0f0c4a5755cc0de3f0

Contents?: true

Size: 497 Bytes

Versions: 12

Compression:

Stored size: 497 Bytes

Contents

module FastGettext
  # Responsibility:
  #  - decide which repository to choose from given input
  module TranslationRepository
    extend self

    def build(name, options)
      type = options[:type] || :mo
      class_name = type.to_s.split('_').map(&:capitalize).join
      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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fast_gettext-1.8.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.7.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.1.2 lib/fast_gettext/translation_repository.rb
fast_gettext-1.1.1 lib/fast_gettext/translation_repository.rb
fast_gettext-1.6.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.5.1 lib/fast_gettext/translation_repository.rb
fast_gettext-1.5.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.4.1 lib/fast_gettext/translation_repository.rb
fast_gettext-1.4.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.3.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.2.0 lib/fast_gettext/translation_repository.rb
fast_gettext-1.1.0 lib/fast_gettext/translation_repository.rb