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.70 lib/tenon/i18n_lookup.rb
tenon-1.0.69 lib/tenon/i18n_lookup.rb
tenon-1.0.68 lib/tenon/i18n_lookup.rb
tenon-1.0.67 lib/tenon/i18n_lookup.rb
tenon-1.0.66 lib/tenon/i18n_lookup.rb
tenon-1.0.65 lib/tenon/i18n_lookup.rb
tenon-1.0.64 lib/tenon/i18n_lookup.rb
tenon-1.0.63 lib/tenon/i18n_lookup.rb
tenon-1.0.62 lib/tenon/i18n_lookup.rb
tenon-1.0.61 lib/tenon/i18n_lookup.rb
tenon-1.0.60 lib/tenon/i18n_lookup.rb
tenon-1.0.59 lib/tenon/i18n_lookup.rb
tenon-1.0.57 lib/tenon/i18n_lookup.rb
tenon-1.0.56 lib/tenon/i18n_lookup.rb
tenon-1.0.55 lib/tenon/i18n_lookup.rb
tenon-1.0.54 lib/tenon/i18n_lookup.rb
tenon-1.0.53 lib/tenon/i18n_lookup.rb
tenon-1.0.52 lib/tenon/i18n_lookup.rb
tenon-1.0.51 lib/tenon/i18n_lookup.rb
tenon-1.0.50 lib/tenon/i18n_lookup.rb