Class: Mongory::Matchers::LteMatcher
- Inherits:
-
AbstractMatcher
- Object
- AbstractMatcher
- Mongory::Matchers::LteMatcher
- Defined in:
- lib/mongory/matchers/lte_matcher.rb
Overview
LteMatcher implements the $lte
(less than or equal to) operator.
It returns true if the record is less than or equal to the condition value.
This matcher inherits from AbstractMatcher and uses the <=
operator.
Constant Summary
Constants inherited from AbstractMatcher
AbstractMatcher::KEY_NOT_FOUND
Instance Attribute Summary
Attributes inherited from AbstractMatcher
Instance Method Summary collapse
-
#raw_proc ⇒ Proc
Creates a raw Proc that performs the less-than-or-equal comparison.
Methods inherited from AbstractMatcher
#cached_proc, #check_validity!, #debug_proc, define_matcher, #initialize, #match, #match?, #render_tree, #uniq_key
Methods included from Utils
included, included_classes, #is_blank?, #is_present?
Constructor Details
This class inherits a constructor from Mongory::Matchers::AbstractMatcher
Instance Method Details
#raw_proc ⇒ Proc
Note:
The proc includes error handling for invalid comparisons
Creates a raw Proc that performs the less-than-or-equal comparison.
The Proc uses the <=
operator to compare values.
24 25 26 27 28 29 30 31 32 |
# File 'lib/mongory/matchers/lte_matcher.rb', line 24 def raw_proc condition = @condition Proc.new do |record| record <= condition rescue StandardError false end end |