Class: ArelOperators::Finder::Comparators
- Inherits:
-
Object
- Object
- ArelOperators::Finder::Comparators
- Defined in:
- lib/arel_operators/finder/comparators.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(finder, field) ⇒ Comparators
constructor
A new instance of Comparators.
- #nil? ⇒ Boolean
Constructor Details
#initialize(finder, field) ⇒ Comparators
Returns a new instance of Comparators.
4 5 6 7 |
# File 'lib/arel_operators/finder/comparators.rb', line 4 def initialize(finder, field) @finder = finder @field = finder.table[field] end |
Class Method Details
.convert_to_arel(operation, arel_method) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/arel_operators/finder/comparators.rb', line 9 def self.convert_to_arel(operation, arel_method) define_method(operation) do |other| arel_clause = @field.send(arel_method, other) ArelOperators::Finder.new(@finder.table, arel_clause) end end |
Instance Method Details
#nil? ⇒ Boolean
16 17 18 |
# File 'lib/arel_operators/finder/comparators.rb', line 16 def nil? self == nil end |