Sha256: 000f4db3c58bfd60d46b1582207a4936be2413fe8da67c72e604ec7169a01848

Contents?: true

Size: 586 Bytes

Versions: 63

Compression:

Stored size: 586 Bytes

Contents

module Tenon
  class I18nLookup
    def initialize(klass)
      @klass = klass
    end

    def fields
      self.class.fields[:tables][@klass.to_s.underscore.pluralize.to_sym] || []
    end

    def self.fields
      @@fields ||= set_fields
    end

    def self.set_fields
      default = { tables: {} }
      if File.exist?(config_file)
        result = YAML.load(File.open(config_file)).recursive_symbolize_keys!
        result || default
      else
        default
      end
    end

    def self.config_file
      File.join(Rails.root, 'config/i18n_fields.yml')
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
tenon-1.0.49 lib/tenon/i18n_lookup.rb
tenon-1.0.48 lib/tenon/i18n_lookup.rb
tenon-1.0.47 lib/tenon/i18n_lookup.rb
tenon-1.0.46 lib/tenon/i18n_lookup.rb
tenon-1.0.45 lib/tenon/i18n_lookup.rb
tenon-1.0.44 lib/tenon/i18n_lookup.rb
tenon-1.0.43 lib/tenon/i18n_lookup.rb
tenon-1.0.42 lib/tenon/i18n_lookup.rb
tenon-1.0.41 lib/tenon/i18n_lookup.rb
tenon-1.0.40 lib/tenon/i18n_lookup.rb
tenon-1.0.39 lib/tenon/i18n_lookup.rb
tenon-1.0.38 lib/tenon/i18n_lookup.rb
tenon-1.0.37 lib/tenon/i18n_lookup.rb
tenon-1.0.36 lib/tenon/i18n_lookup.rb
tenon-1.0.35 lib/tenon/i18n_lookup.rb
tenon-1.0.33 lib/tenon/i18n_lookup.rb
tenon-1.0.32 lib/tenon/i18n_lookup.rb
tenon-1.0.31 lib/tenon/i18n_lookup.rb
tenon-1.0.30 lib/tenon/i18n_lookup.rb
tenon-1.0.29 lib/tenon/i18n_lookup.rb