Class: Slimmer::Processors::MetadataInserter
- Inherits:
-
Object
- Object
- Slimmer::Processors::MetadataInserter
- Defined in:
- lib/slimmer/processors/metadata_inserter.rb
Instance Method Summary collapse
- #filter(_old_doc, new_doc) ⇒ Object
-
#initialize(response, app_name) ⇒ MetadataInserter
constructor
A new instance of MetadataInserter.
Constructor Details
#initialize(response, app_name) ⇒ MetadataInserter
Returns a new instance of MetadataInserter.
3 4 5 6 |
# File 'lib/slimmer/processors/metadata_inserter.rb', line 3 def initialize(response, app_name) @headers = response.headers @app_name = app_name end |
Instance Method Details
#filter(_old_doc, new_doc) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/slimmer/processors/metadata_inserter.rb', line 8 def filter(_old_doc, new_doc) head = new_doc.at_css("head") # temporarily duplicate these tags with the old names to avoid deployment issues ("analytics:organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER], head, new_doc) ("analytics:world-locations", @headers[Slimmer::Headers::WORLD_LOCATIONS_HEADER], head, new_doc) ("organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER], head, new_doc) ("world-locations", @headers[Slimmer::Headers::WORLD_LOCATIONS_HEADER], head, new_doc) ("format", @headers[Slimmer::Headers::FORMAT_HEADER], head, new_doc) ("search-result-count", @headers[Slimmer::Headers::RESULT_COUNT_HEADER], head, new_doc) ("rendering-application", @app_name, head, new_doc) end |