Class: Dynomite::Item::Query::Relation::WhereField
- Inherits:
-
Object
- Object
- Dynomite::Item::Query::Relation::WhereField
- Defined in:
- lib/dynomite/item/query/relation/where_field.rb
Instance Attribute Summary collapse
-
#full_field ⇒ Object
readonly
Returns the value of attribute full_field.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #field ⇒ Object
-
#initialize(full_field, value, index) ⇒ WhereField
constructor
A new instance of WhereField.
- #not? ⇒ Boolean
- #operator ⇒ Object
- #raw_operator ⇒ Object
-
#reference ⇒ Object
Example: price_1, price_2.
Constructor Details
#initialize(full_field, value, index) ⇒ WhereField
Returns a new instance of WhereField.
4 5 6 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 4 def initialize(full_field, value, index) @full_field, @value, @index = full_field.to_s, value, index end |
Instance Attribute Details
#full_field ⇒ Object (readonly)
Returns the value of attribute full_field.
3 4 5 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 3 def full_field @full_field end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
3 4 5 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 3 def index @index end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 3 def value @value end |
Instance Method Details
#field ⇒ Object
8 9 10 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 8 def field @full_field.split('.').first end |
#not? ⇒ Boolean
18 19 20 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 18 def not? raw_operator.match(/^not_/) if raw_operator end |
#operator ⇒ Object
12 13 14 15 16 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 12 def operator if raw_operator not? ? raw_operator[4..-1] : raw_operator end end |
#raw_operator ⇒ Object
22 23 24 25 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 22 def raw_operator _, operator = @full_field.split('.') operator.downcase if operator end |
#reference ⇒ Object
Example: price_1, price_2
28 29 30 |
# File 'lib/dynomite/item/query/relation/where_field.rb', line 28 def reference "#{field}_#{@index}" end |