Class: Polecat::Term
- Inherits:
-
Object
- Object
- Polecat::Term
- Defined in:
- lib/polecat/term.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
the field name which should be found.
-
#operator ⇒ Object
readonly
the operator to match the field with the value.
-
#value ⇒ Object
readonly
the search value which get’s matched against the document field.
Instance Method Summary collapse
-
#initialize(field, operator, value) ⇒ Term
constructor
create a new Term for a query.
Constructor Details
#initialize(field, operator, value) ⇒ Term
create a new Term for a query
11 12 13 14 15 16 17 18 19 |
# File 'lib/polecat/term.rb', line 11 def initialize field, operator, value @field = field @operator = operator if @operator == :eq && value.class == String @value = /^#{value}$/ else @value = value end end |
Instance Attribute Details
#field ⇒ Object (readonly)
the field name which should be found
4 5 6 |
# File 'lib/polecat/term.rb', line 4 def field @field end |
#operator ⇒ Object (readonly)
the operator to match the field with the value
6 7 8 |
# File 'lib/polecat/term.rb', line 6 def operator @operator end |
#value ⇒ Object (readonly)
the search value which get’s matched against the document field
8 9 10 |
# File 'lib/polecat/term.rb', line 8 def value @value end |