Sha256: 5d9c198c1964727cc922b647ea89d1e0af24aaa03e18e08c69c1e18d433a7d34

Contents?: true

Size: 758 Bytes

Versions: 44

Compression:

Stored size: 758 Bytes

Contents

module Sunspot
  module DSL
    class Function #:nodoc:
      def initialize(functional) #:nodoc:
        @functional = functional
      end

      # Special case to handle <http://wiki.apache.org/solr/FunctionQuery#sub>
      # because `Kernel#sub` exists so `method_missing` will not be called
      # for this function.
      def sub(*args) #:nodoc:
        create_function_query(:sub, *args)
      end

      def method_missing(method, *args, &block)
        create_function_query(method, *args)
      end

      private

      def create_function_query(method, *args)
        function_args = args.map { |arg| @functional.create_function_query(arg) }
        Sunspot::Query::FunctionalFunctionQuery.new(method, function_args)
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
sunspot-2.7.1 lib/sunspot/dsl/function.rb
sunspot-2.7.0 lib/sunspot/dsl/function.rb
sunspot-2.6.0 lib/sunspot/dsl/function.rb
sunspot-2.5.0 lib/sunspot/dsl/function.rb
sunspot-2.4.0 lib/sunspot/dsl/function.rb
sunspot-2.3.0 lib/sunspot/dsl/function.rb
sunspot-2.2.8 lib/sunspot/dsl/function.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/lib/sunspot/dsl/function.rb
sunspot-2.2.7 lib/sunspot/dsl/function.rb
sunspot-2.2.6 lib/sunspot/dsl/function.rb
sunspot-2.2.5 lib/sunspot/dsl/function.rb
sunspot-2.2.4 lib/sunspot/dsl/function.rb
sunspot-2.2.3 lib/sunspot/dsl/function.rb
sunspot-2.2.2 lib/sunspot/dsl/function.rb
sunspot-2.2.1 lib/sunspot/dsl/function.rb
sunspot-2.2.0 lib/sunspot/dsl/function.rb
sunspot-2.1.1 lib/sunspot/dsl/function.rb
sunspot-2.1.0 lib/sunspot/dsl/function.rb
sunspot-2.0.0 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.130115 lib/sunspot/dsl/function.rb