Class: Ransack::Nodes::Node
- Inherits:
-
Object
- Object
- Ransack::Nodes::Node
show all
- Defined in:
- lib/ransack/nodes/node.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(context) ⇒ Node
21
22
23
|
# File 'lib/ransack/nodes/node.rb', line 21
def initialize(context)
@context = context
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
4
5
6
|
# File 'lib/ransack/nodes/node.rb', line 4
def context
@context
end
|
Class Method Details
.i18n_alias(opts = {}) ⇒ Object
16
17
18
|
# File 'lib/ransack/nodes/node.rb', line 16
def i18n_alias(opts = {})
self.i18n_aliases.merge! Hash[opts.map {|k, v| [k.to_s, v.to_s]}]
end
|
.i18n_word(*args) ⇒ Object
12
13
14
|
# File 'lib/ransack/nodes/node.rb', line 12
def i18n_word(*args)
self.i18n_words += args.map(&:to_s)
end
|
Instance Method Details
#translate(key, options = {}) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/ransack/nodes/node.rb', line 25
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
|