Class: CafeCar::QueryBuilder::Op
- Inherits:
-
Struct
- Object
- Struct
- CafeCar::QueryBuilder::Op
- Defined in:
- lib/cafe_car/query_builder.rb
Instance Attribute Summary collapse
-
#op ⇒ Object
Returns the value of attribute op.
-
#rhs ⇒ Object
Returns the value of attribute rhs.
Instance Method Summary collapse
- #arel(node) ⇒ Object
- #arel_op ⇒ Object
- #flop ⇒ Object
-
#initialize(op, rhs) ⇒ Op
constructor
A new instance of Op.
- #map ⇒ Object
Constructor Details
#initialize(op, rhs) ⇒ Op
Returns a new instance of Op.
6 7 8 |
# File 'lib/cafe_car/query_builder.rb', line 6 def initialize(op, rhs) super(op.to_sym, rhs) end |
Instance Attribute Details
#op ⇒ Object
Returns the value of attribute op
5 6 7 |
# File 'lib/cafe_car/query_builder.rb', line 5 def op @op end |
#rhs ⇒ Object
Returns the value of attribute rhs
5 6 7 |
# File 'lib/cafe_car/query_builder.rb', line 5 def rhs @rhs end |
Instance Method Details
#arel(node) ⇒ Object
13 |
# File 'lib/cafe_car/query_builder.rb', line 13 def arel(node) = node.public_send(arel_op, rhs) |
#arel_op ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cafe_car/query_builder.rb', line 15 def arel_op case op when :< then :lt when :> then :gt when :>= then :gteq when :<= then :lteq when :== then :eq else op end end |
#flop ⇒ Object
10 |
# File 'lib/cafe_car/query_builder.rb', line 10 def flop = op.to_s.tr("<>", "><").to_sym |