Class: Cuprum::Collections::Scopes::Criteria::Parser::BlockParser
- Inherits:
-
Object
- Object
- Cuprum::Collections::Scopes::Criteria::Parser::BlockParser
- Defined in:
- lib/cuprum/collections/scopes/criteria/parser.rb
Overview
Utility class for parsing block operators.
Class Method Summary collapse
-
.instance ⇒ BlockParser
A memoized class instance.
Instance Method Summary collapse
- #equals(value) ⇒ Object (also: #equal, #eq)
- #greater_than(value) ⇒ Object (also: #gt)
- #greater_than_or_equal_to(value) ⇒ Object (also: #gte)
- #less_than(value) ⇒ Object (also: #lt)
- #less_than_or_equal_to(value) ⇒ Object (also: #lte)
- #not_equal(value) ⇒ Object (also: #ne)
- #not_null ⇒ Object
- #not_one_of(*values) ⇒ Object
- #null ⇒ Object
- #one_of(*values) ⇒ Object
Class Method Details
.instance ⇒ BlockParser
Returns a memoized class instance.
13 14 15 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 13 def self.instance @instance ||= new end |
Instance Method Details
#equals(value) ⇒ Object Also known as: equal, eq
17 18 19 20 21 22 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 17 def equals(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::EQUAL, value ) end |
#greater_than(value) ⇒ Object Also known as: gt
26 27 28 29 30 31 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 26 def greater_than(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::GREATER_THAN, value ) end |
#greater_than_or_equal_to(value) ⇒ Object Also known as: gte
34 35 36 37 38 39 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 34 def greater_than_or_equal_to(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::GREATER_THAN_OR_EQUAL_TO, value ) end |
#less_than(value) ⇒ Object Also known as: lt
42 43 44 45 46 47 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 42 def less_than(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::LESS_THAN, value ) end |
#less_than_or_equal_to(value) ⇒ Object Also known as: lte
50 51 52 53 54 55 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 50 def less_than_or_equal_to(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::LESS_THAN_OR_EQUAL_TO, value ) end |
#not_equal(value) ⇒ Object Also known as: ne
58 59 60 61 62 63 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 58 def not_equal(value) OperatorExpression.new( Cuprum::Collections::Queries::Operators::NOT_EQUAL, value ) end |
#not_null ⇒ Object
66 67 68 69 70 71 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 66 def not_null OperatorExpression.new( Cuprum::Collections::Queries::Operators::NOT_NULL, nil ) end |
#not_one_of(*values) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 73 def not_one_of(*values) OperatorExpression.new( Cuprum::Collections::Queries::Operators::NOT_ONE_OF, flatten_values(values) ) end |
#null ⇒ Object
80 81 82 83 84 85 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 80 def null OperatorExpression.new( Cuprum::Collections::Queries::Operators::NULL, nil ) end |
#one_of(*values) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/cuprum/collections/scopes/criteria/parser.rb', line 87 def one_of(*values) OperatorExpression.new( Cuprum::Collections::Queries::Operators::ONE_OF, flatten_values(values) ) end |