Class: Blacklight::Response::SpellcheckComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/response/spellcheck_component.rb

Overview

Render spellcheck results for a search query

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(response:, options: nil) ⇒ SpellcheckComponent

Returns a new instance of SpellcheckComponent.

Parameters:

  • response (Blacklight::Response)
  • options (Array<String>) (defaults to: nil)

    explicit spellcheck options to render



9
10
11
12
13
# File 'app/components/blacklight/response/spellcheck_component.rb', line 9

def initialize(response:, options: nil)
  @response = response
  @options = options
  @options ||= options_from_response(@response)
end

Instance Method Details



15
16
17
18
19
# File 'app/components/blacklight/response/spellcheck_component.rb', line 15

def link_to_query(query)
  Deprecation.silence(Blacklight::UrlHelperBehavior) do
    helpers.link_to_query(query)
  end
end

#render?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'app/components/blacklight/response/spellcheck_component.rb', line 21

def render?
  Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
    @options&.any? && helpers.should_show_spellcheck_suggestions?(@response)
  end
end