Sha256: 5100322520c1bd45af27aede83b4dfbb3b7428e1babb0e3e7ab57ab333b94d0a
Contents?: true
Size: 780 Bytes
Versions: 46
Compression:
Stored size: 780 Bytes
Contents
module Ransack module Nodes class Node attr_reader :context delegate :contextualize, :to => :context class_attribute :i18n_words class_attribute :i18n_aliases self.i18n_words = [] self.i18n_aliases = {} class << self def i18n_word(*args) self.i18n_words += args.map(&:to_s) end def i18n_alias(opts = {}) self.i18n_aliases.merge! Hash[opts.map { |k, v| [k.to_s, v.to_s] }] end end def initialize(context) @context = context end def translate(key, options = {}) key = i18n_aliases[key.to_s] if i18n_aliases.has_key?(key.to_s) if i18n_words.include?(key.to_s) Translate.word(key) end end end end end
Version data entries
46 entries across 46 versions & 4 rubygems