Class: Repository::FilterFactory
- Inherits:
-
Object
- Object
- Repository::FilterFactory
- Defined in:
- lib/repository/filter_factory.rb
Instance Method Summary collapse
- #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_eq(field, value) ⇒ Object
- #not_in(field, value) ⇒ Object
- #or(*filters) ⇒ Object
Instance Method Details
#eq(field, value) ⇒ Object
6 7 8 9 |
# File 'lib/repository/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/repository/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/repository/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/repository/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
52 53 54 55 56 |
# File 'lib/repository/filter_factory.rb', line 52 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/repository/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/repository/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_eq(field, value) ⇒ Object
11 12 13 14 |
# File 'lib/repository/filter_factory.rb', line 11 def not_eq(field, value) assert_field!(field) Filter.new(field, '!=', value) end |