module OpenSearch::DSL::Search::BaseCompoundFilterComponent::InstanceMethods
Common functionality for the compound filter components
Public Instance Methods
call()
click to toggle source
Evaluates the block passed to initializer, ensuring it is called just once
@return [self]
@api private
# File lib/opensearch/dsl/search/base_compound_filter_component.rb, line 56 def call @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block && ! @_block_called @_block_called = true self end
to_hash(options={})
click to toggle source
Convert the component to a Hash
A default implementation, DSL
classes can overload it.
@return [Hash]
Calls superclass method
# File lib/opensearch/dsl/search/base_compound_filter_component.rb, line 68 def to_hash(options={}) case when @value.empty? && ! @block @hash = super when @block call @hash = { name.to_sym => @value.map { |i| i.to_hash } } else @hash = { name.to_sym => @value } end @hash end