Class: Slimmer::Processors::SearchPathSetter
- Inherits:
-
Object
- Object
- Slimmer::Processors::SearchPathSetter
- Defined in:
- lib/slimmer/processors/search_path_setter.rb
Instance Method Summary collapse
- #filter(_content_document, page_template) ⇒ Object
-
#initialize(response) ⇒ SearchPathSetter
constructor
A new instance of SearchPathSetter.
- #search_scope ⇒ Object
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_scope ⇒ Object
13 14 15 |
# File 'lib/slimmer/processors/search_path_setter.rb', line 13 def search_scope @response.headers[Slimmer::Headers::SEARCH_PATH_HEADER] end |