Sha256: 3bb68677ad4df3663e1ca41b5ec58803f67b296941b610807f143055422186b2

Contents?: true

Size: 539 Bytes

Versions: 17

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Middlewares::ValidOptions <
  ThinkingSphinx::Middlewares::Middleware

  def call(contexts)
    contexts.each { |context| check_options context.search.options }

    app.call contexts
  end

  private

  def check_options(options)
    unknown = invalid_keys options.keys
    return if unknown.empty?

    ThinkingSphinx::Logger.log :caution,
      "Unexpected search options: #{unknown.inspect}"
  end

  def invalid_keys(keys)
    keys - ThinkingSphinx::Search.valid_options
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/middlewares/valid_options.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/middlewares/valid_options.rb