Sha256: 3616849a1fdcf039584ae1f32adda5f4af27d1947a4dbbaab4f6969513c68d5b

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

module Indexers
  module Dsl
    class Search < Traitable

      private

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

      def add_argument(name, args, options)
        if name == :query && args.any?
          indexer = Indexers.definitions.find(args.first)
          hash = self.class.new(indexer, [options], &indexer.options[:search]).to_h
          @parent[name] = hash[:query]
        else
          super
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
indexers-5.1.0 lib/indexers/dsl/search.rb
indexers-4.1.0.1 lib/indexers/dsl/search.rb
indexers-4.1.0.0 lib/indexers/dsl/search.rb