File: translation_repository.rb

package info (click to toggle)
ruby-fast-gettext 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 692 kB
  • ctags: 254
  • sloc: ruby: 2,838; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module FastGettext
  # Responsibility:
  #  - decide which repository to choose from given input
  module TranslationRepository
    extend self

    # only single-word types supported atm (mytype works, MyType will not)
    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
  end
end