Class: MemoryDb::FilterFactory
- Inherits:
-
Object
- Object
- MemoryDb::FilterFactory
- Defined in:
- lib/memorydb/filter_factory.rb
Instance Method Summary collapse
- #and(*filters) ⇒ Object
- #contains(field, value) ⇒ Object
- #eq(field, value) ⇒ Object
- #gt(field, value) ⇒ Object
- #gte(field, value) ⇒ Object
- #in(field, value) ⇒ Object
- #like(field, value) ⇒ Object
- #lt(field, value) ⇒ Object
- #lte(field, value) ⇒ Object
- #not(filter) ⇒ Object
- #not_eq(field, value) ⇒ Object
- #not_in(field, value) ⇒ Object
- #or(*filters) ⇒ Object
Instance Method Details
#and(*filters) ⇒ Object
67 68 69 |
# File 'lib/memorydb/filter_factory.rb', line 67 def and(*filters) Filter.new(nil, 'and', filters) end |
#contains(field, value) ⇒ Object
46 47 48 49 |
# File 'lib/memorydb/filter_factory.rb', line 46 def contains(field, value) assert_field!(field) Filter.new(field, 'contains', value) end |
#eq(field, value) ⇒ Object
6 7 8 9 |
# File 'lib/memorydb/filter_factory.rb', line 6 def eq(field, value) assert_field!(field) Filter.new(field, '=', value) end |
#gt(field, value) ⇒ Object
28 29 30 31 32 |
# File 'lib/memorydb/filter_factory.rb', line 28 def gt(field, value) assert_field!(field) assert_not_nil!('Greater than', value) Filter.new(field, '>', value) end |
#gte(field, value) ⇒ Object
34 35 36 37 38 |
# File 'lib/memorydb/filter_factory.rb', line 34 def gte(field, value) assert_field!(field) assert_not_nil!('Greater than or equal to', value) Filter.new(field, '>=', value) end |
#in(field, value) ⇒ Object
40 41 42 43 44 |
# File 'lib/memorydb/filter_factory.rb', line 40 def in(field, value) assert_field!(field) assert_to_a!('Inclusion', value) Filter.new(field, 'in', value.to_a) end |
#like(field, value) ⇒ Object
57 58 59 60 61 |
# File 'lib/memorydb/filter_factory.rb', line 57 def like(field, value) assert_field!(field) assert_str_or_sym!(value, 'Value') Filter.new(field, 'like', value) end |
#lt(field, value) ⇒ Object
16 17 18 19 20 |
# File 'lib/memorydb/filter_factory.rb', line 16 def lt(field, value) assert_field!(field) assert_not_nil!('Less than', value) Filter.new(field, '<', value) end |
#lte(field, value) ⇒ Object
22 23 24 25 26 |
# File 'lib/memorydb/filter_factory.rb', line 22 def lte(field, value) assert_field!(field) assert_not_nil!('Less than or equal to', value) Filter.new(field, '<=', value) end |
#not(filter) ⇒ Object
71 72 73 |
# File 'lib/memorydb/filter_factory.rb', line 71 def not(filter) Filter.new(nil, 'not', filter) end |
#not_eq(field, value) ⇒ Object
11 12 13 14 |
# File 'lib/memorydb/filter_factory.rb', line 11 def not_eq(field, value) assert_field!(field) Filter.new(field, '!=', value) end |