Class: ElasticRansack::Predicate
- Inherits:
-
Object
- Object
- ElasticRansack::Predicate
- Defined in:
- lib/elastic_ransack/predicate.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
Instance Method Summary collapse
-
#initialize(name, opts = {}) ⇒ Predicate
constructor
A new instance of Predicate.
Constructor Details
#initialize(name, opts = {}) ⇒ Predicate
Returns a new instance of Predicate.
5 6 7 8 9 10 |
# File 'lib/elastic_ransack/predicate.rb', line 5 def initialize(name, opts={}) @name = name @regexp = opts[:regexp] || Regexp.new("^(.+)_#{@name}$") @query = opts[:query] raise(ArgumentError, ':query option is required') unless @query end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/elastic_ransack/predicate.rb', line 3 def name @name end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
3 4 5 |
# File 'lib/elastic_ransack/predicate.rb', line 3 def query @query end |
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
3 4 5 |
# File 'lib/elastic_ransack/predicate.rb', line 3 def regexp @regexp end |