Class: Torque::PostgreSQL::PredicateBuilder::ArelAttributeHandler
- Inherits:
-
Object
- Object
- Torque::PostgreSQL::PredicateBuilder::ArelAttributeHandler
- Defined in:
- lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb
Class Method Summary collapse
-
.call(*args) ⇒ Object
Shortcut.
Instance Method Summary collapse
- #call(attribute, value) ⇒ Object
-
#initialize ⇒ ArelAttributeHandler
constructor
A new instance of ArelAttributeHandler.
Constructor Details
#initialize ⇒ ArelAttributeHandler
Returns a new instance of ArelAttributeHandler.
12 13 14 |
# File 'lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb', line 12 def initialize(*) # There is no need to use or save the predicate builder here end |
Class Method Details
.call(*args) ⇒ Object
Shortcut
8 9 10 |
# File 'lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb', line 8 def self.call(*args) new.call(*args) end |
Instance Method Details
#call(attribute, value) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb', line 16 def call(attribute, value) case when array_typed?(attribute) && array_typed?(value) then attribute.overlaps(value) when array_typed?(attribute) then value.eq(FN.any(attribute)) when array_typed?(value) then attribute.eq(FN.any(value)) else attribute.eq(value) end end |