Class: Slimmer::Processors::SearchPathSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/slimmer/processors/search_path_setter.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ SearchPathSetter

Returns a new instance of SearchPathSetter.



3
4
5
# File 'lib/slimmer/processors/search_path_setter.rb', line 3

def initialize(response)
  @response = response
end

Instance Method Details

#filter(_content_document, page_template) ⇒ Object



7
8
9
10
11
# File 'lib/slimmer/processors/search_path_setter.rb', line 7

def filter(_content_document, page_template)
  if search_scope && page_template.at_css("form#search")
    page_template.at_css("form#search").attributes["action"].value = search_scope
  end
end

#search_scopeObject



13
14
15
# File 'lib/slimmer/processors/search_path_setter.rb', line 13

def search_scope
  @response.headers[Slimmer::Headers::SEARCH_PATH_HEADER]
end