Class: Elasticband::Filter::Term

Inherits:
Elasticband::Filter show all
Defined in:
lib/elasticband/filter/term.rb

Constant Summary

Constants inherited from Elasticband::Filter

PARSE_FILTERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Elasticband::Filter

parse, #parse

Constructor Details

#initialize(filter, field, options = {}) ⇒ Term

Returns a new instance of Term.



6
7
8
9
10
# File 'lib/elasticband/filter/term.rb', line 6

def initialize(filter, field, options = {})
  self.filter = filter
  self.field = field.to_sym
  self.options = options
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



4
5
6
# File 'lib/elasticband/filter/term.rb', line 4

def field
  @field
end

#filterObject

Returns the value of attribute filter.



4
5
6
# File 'lib/elasticband/filter/term.rb', line 4

def filter
  @filter
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/elasticband/filter/term.rb', line 4

def options
  @options
end

Instance Method Details

#to_hObject



12
13
14
# File 'lib/elasticband/filter/term.rb', line 12

def to_h
  { term: filter_hash }
end