Class: Ransack::Configuration::PredicateCollection
- Inherits:
-
Object
- Object
- Ransack::Configuration::PredicateCollection
- Defined in:
- lib/ransack/configuration.rb
Instance Attribute Summary collapse
-
#sorted_names_with_underscores ⇒ Object
readonly
Returns the value of attribute sorted_names_with_underscores.
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ PredicateCollection
constructor
A new instance of PredicateCollection.
Constructor Details
#initialize ⇒ PredicateCollection
Returns a new instance of PredicateCollection.
12 13 14 15 |
# File 'lib/ransack/configuration.rb', line 12 def initialize @collection = {} @sorted_names_with_underscores = [] end |
Instance Attribute Details
#sorted_names_with_underscores ⇒ Object (readonly)
Returns the value of attribute sorted_names_with_underscores.
10 11 12 |
# File 'lib/ransack/configuration.rb', line 10 def sorted_names_with_underscores @sorted_names_with_underscores end |
Instance Method Details
#[]=(key, value) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ransack/configuration.rb', line 19 def []=(key, value) @sorted_names_with_underscores << [key, '_' + key] @sorted_names_with_underscores.sort! { |(a, _), (b, _)| b.length <=> a.length } @collection[key] = value end |