Sha256: d9a781b6a0a74276aecf28d6ef813f0980273c531c95c850b0d23623340a2bac

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

module Indexes
  module Dsl
    class Search < Api

      private

      def add_block(name, args, options, &block)
        if %i(functions must must_not should).include?(name)
          child = []
          @parent[name] = child
          self.class.new [], child, &block
        else
          super
        end
      end

      def add_argument(name, args, options)
        if name == :query && args.first.is_a?(Symbol)
          @parent[name] = Indexes.definitions.find(args.first).search([options]).query[:query]
        else
          super
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
indexes-4.0.0.2 lib/indexes/dsl/search.rb
indexes-4.0.0.1 lib/indexes/dsl/search.rb