Class: Stretchy::Filters::ExistsFilter

Inherits:
Base
  • Object
show all
Defined in:
lib/stretchy/filters/exists_filter.rb

Instance Method Summary collapse

Methods included from Utils::Validation

#errors, included, #json_attributes, #require_one!, #require_only_one!, #valid?, #validate!, #validator

Constructor Details

#initialize(field) ⇒ ExistsFilter



15
16
17
18
# File 'lib/stretchy/filters/exists_filter.rb', line 15

def initialize(field)
  @field = field
  validate!
end

Instance Method Details

#to_searchObject



20
21
22
23
24
25
26
# File 'lib/stretchy/filters/exists_filter.rb', line 20

def to_search
  {
    exists: {
      field: @field
    }
  }
end