slimmer 12.0.0 → 13.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +33 -0
- data/README.md +1 -50
- data/Rakefile +4 -4
- data/bin/render_slimmer_error +13 -14
- data/lib/slimmer.rb +27 -34
- data/lib/slimmer/app.rb +25 -27
- data/lib/slimmer/cucumber.rb +2 -9
- data/lib/slimmer/headers.rb +14 -13
- data/lib/slimmer/processors/body_class_copier.rb +4 -4
- data/lib/slimmer/processors/body_inserter.rb +4 -4
- data/lib/slimmer/processors/conditional_comment_mover.rb +2 -4
- data/lib/slimmer/processors/footer_remover.rb +1 -1
- data/lib/slimmer/processors/header_context_inserter.rb +3 -3
- data/lib/slimmer/processors/inside_header_inserter.rb +2 -2
- data/lib/slimmer/processors/metadata_inserter.rb +10 -10
- data/lib/slimmer/processors/navigation_mover.rb +4 -5
- data/lib/slimmer/processors/search_parameter_inserter.rb +7 -7
- data/lib/slimmer/processors/search_path_setter.rb +3 -3
- data/lib/slimmer/processors/search_remover.rb +1 -1
- data/lib/slimmer/processors/tag_mover.rb +18 -11
- data/lib/slimmer/processors/title_inserter.rb +6 -6
- data/lib/slimmer/railtie.rb +13 -1
- data/lib/slimmer/rspec.rb +3 -10
- data/lib/slimmer/skin.rb +16 -16
- data/lib/slimmer/test.rb +3 -3
- data/lib/slimmer/test_templates/header_footer_only.html +2 -0
- data/lib/slimmer/test_templates/wrapper.html +2 -0
- data/lib/slimmer/version.rb +1 -1
- data/lib/tasks/slimmer.rake +2 -2
- metadata +50 -59
- data/lib/slimmer/component_resolver.rb +0 -26
- data/lib/slimmer/govuk_components.rb +0 -57
- data/lib/slimmer/i18n_backend.rb +0 -56
- data/lib/slimmer/local_component_resolver.rb +0 -19
- data/lib/slimmer/local_govuk_components.rb +0 -49
- data/lib/slimmer/network_component_resolver.rb +0 -45
- data/lib/slimmer/test_helpers/govuk_components.rb +0 -18
- data/lib/tasks/lint.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ddad98c75bd0222c98ea9a7021096064cd2786c93f647c5390b39fcf489a3ab8
|
4
|
+
data.tar.gz: 63217d5ac791ffa9de31f0f20178d997cc0fad22ddea6e3728bcbb2405277ce6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9048af33f02df5b5e6e9e36382cf38c1028bbeb6eafe2019bc2035e0c4f5b71027c3ce79266e1f7fd013578e4024b0aa1d7735fae2a0bb6c9abd0a81ad4dbd92
|
7
|
+
data.tar.gz: 3af49e52feefa8c44480ff144512a1347157ccae6aafb5596a03b1d3382a53e13b53e0a82f1f8041d5a0b71effe6410727dfd2a21b27ec84586822b4ea64afa9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
# 13.2.1
|
2
|
+
|
3
|
+
* Fix deprecation warning: `Module#parent_name` has been renamed to
|
4
|
+
`module_parent_name`. `parent_name` is deprecated and will be removed in
|
5
|
+
Rails 6.1. (#237)
|
6
|
+
* Migrate from govuk-lint to rubocop-govuk (#237)
|
7
|
+
* Remove lint rake task (#237)
|
8
|
+
* Fix linting issues (#237)
|
9
|
+
* Fix deprecation warning: Mocha deprecation warning at
|
10
|
+
/my/local/path/to/test/test_helper.rb:6:in 'require': Require
|
11
|
+
'mocha/test_unit', 'mocha/minitest' or 'mocha/api' instead of 'mocha/setup'.
|
12
|
+
(#237)
|
13
|
+
|
14
|
+
# 13.2.0
|
15
|
+
|
16
|
+
* Upgrade Ruby version to 2.6.5. (#234)
|
17
|
+
* Fix linting issues. (#234)
|
18
|
+
|
19
|
+
# 13.1.0
|
20
|
+
|
21
|
+
* Add `js-enabled` to body tag of test templates. (#226)
|
22
|
+
|
23
|
+
# 13.0.0
|
24
|
+
|
25
|
+
* Drop cache TTL to 60 seconds.
|
26
|
+
* BREAKING: Remove the component system, components are now consumed via the [govuk_publishing_components gem](https://github.com/alphagov/govuk_publishing_components)
|
27
|
+
|
28
|
+
# 12.1.0
|
29
|
+
|
30
|
+
* Make sure that the metatags defined in the application are inserted at the
|
31
|
+
top of the page. This means that third parties will see the custom metatags
|
32
|
+
like `og:image` first, and template tags like the default sharing image second (#218)
|
33
|
+
|
1
34
|
# 12.0.0
|
2
35
|
|
3
36
|
* Remove the "report a problem" feature. This is now being covered by the
|
data/README.md
CHANGED
@@ -15,8 +15,7 @@ Slimmer provides a Railtie so no configuration is necessary.
|
|
15
15
|
|
16
16
|
## Caching
|
17
17
|
|
18
|
-
Slimmer makes HTTP requests to `static` for templates
|
19
|
-
are cached for 15 minutes. Slimmer uses `Rails.cache` for this.
|
18
|
+
Slimmer makes HTTP requests to `static` for templates. These are cached using `Rails.cache`.
|
20
19
|
|
21
20
|
## Asset tag helpers
|
22
21
|
|
@@ -82,54 +81,6 @@ YourApp::Application.configure do
|
|
82
81
|
end
|
83
82
|
```
|
84
83
|
|
85
|
-
## GOV.UK Components
|
86
|
-
|
87
|
-
To use [shared template components](https://govuk-static.herokuapp.com/component-guide) you need to include the GOV.UK component module:
|
88
|
-
|
89
|
-
```rb
|
90
|
-
class ApplicationController < ActionController::Base
|
91
|
-
include Slimmer::GovukComponents
|
92
|
-
end
|
93
|
-
```
|
94
|
-
|
95
|
-
This will make calls out to static when you try and render a partial prefixed with `govuk_component`:
|
96
|
-
|
97
|
-
```erb
|
98
|
-
<%= render partial: 'govuk_component/example_component' %>
|
99
|
-
```
|
100
|
-
|
101
|
-
You will need a copy of static running for the templates to be loaded from.
|
102
|
-
|
103
|
-
### Testing components
|
104
|
-
|
105
|
-
In test mode (when `Rails.env.test?` returns `true`), shared components are not
|
106
|
-
fetched from Static. Instead they are rendered as a dummy tag which contains a
|
107
|
-
JSON dump of the `locals` - the arguments passed to the component.
|
108
|
-
|
109
|
-
A test helper is included which returns a CSS selector for finding a given
|
110
|
-
component to assert that it was used. You can make it available in your tests
|
111
|
-
with:
|
112
|
-
|
113
|
-
```rb
|
114
|
-
require 'slimmer/test_helpers/govuk_components'
|
115
|
-
include Slimmer::TestHelpers::GovukComponents
|
116
|
-
```
|
117
|
-
|
118
|
-
And then assert that the component has been used:
|
119
|
-
|
120
|
-
```rb
|
121
|
-
page.should have_css(shared_component_selector('metadata'))
|
122
|
-
```
|
123
|
-
|
124
|
-
Or look for one of the arguments to the component which will have been
|
125
|
-
`JSON.dump`ed inside the tag:
|
126
|
-
|
127
|
-
```rb
|
128
|
-
within(shared_component_selector('title')) do
|
129
|
-
expect(page).to have_content(expected_title_text)
|
130
|
-
end
|
131
|
-
```
|
132
|
-
|
133
84
|
### Cucumber
|
134
85
|
|
135
86
|
Add the following code to features/support:
|
data/Rakefile
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rdoc/task"
|
5
|
-
require
|
5
|
+
require "rake/testtask"
|
6
6
|
|
7
|
-
Dir.glob(
|
7
|
+
Dir.glob("lib/tasks/*.rake").each { |r| import r }
|
8
8
|
|
9
9
|
RDoc::Task.new do |rd|
|
10
10
|
rd.rdoc_files.include("lib/**/*.rb")
|
@@ -12,10 +12,10 @@ RDoc::Task.new do |rd|
|
|
12
12
|
end
|
13
13
|
|
14
14
|
Rake::TestTask.new("test") do |t|
|
15
|
-
t.ruby_opts << "-
|
15
|
+
t.ruby_opts << "-rrubygems"
|
16
16
|
t.libs << "test"
|
17
17
|
t.test_files = FileList["test/**/*_test.rb"]
|
18
18
|
t.verbose = true
|
19
19
|
end
|
20
20
|
|
21
|
-
task :
|
21
|
+
task default: %i[test]
|
data/bin/render_slimmer_error
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "optparse"
|
4
|
+
require "slimmer"
|
5
|
+
require "logger"
|
6
6
|
|
7
7
|
options = {}
|
8
|
-
OptionParser.new do |opts|
|
9
|
-
opts.on
|
10
|
-
'Template to render' do |v|
|
8
|
+
option_parser = OptionParser.new do |opts|
|
9
|
+
opts.on "-t", "--template=TEMPLATE", "Template to render" do |v|
|
11
10
|
options[:template] = v
|
12
11
|
end
|
13
12
|
|
14
|
-
opts.on
|
15
|
-
'Host that serves assets used in the template' do |v|
|
13
|
+
opts.on "-h", "--asset-host=HOST", "Host that serves assets used in the template" do |v|
|
16
14
|
options[:asset_host] = v
|
17
15
|
end
|
18
16
|
|
19
|
-
opts.on
|
20
|
-
'File to write static error page to' do |v|
|
17
|
+
opts.on "-o", "--output-file=FILE", "File to write static error page to" do |v|
|
21
18
|
options[:file] = v
|
22
19
|
end
|
23
|
-
end
|
20
|
+
end
|
21
|
+
|
22
|
+
option_parser.parse!
|
24
23
|
|
25
24
|
raise "Please specify a template" unless options[:template]
|
26
25
|
raise "Please specify an asset host" unless options[:asset_host]
|
@@ -28,13 +27,13 @@ raise "Please specify an output file" unless options[:file]
|
|
28
27
|
|
29
28
|
logger = Logger.new STDOUT
|
30
29
|
logger.level = Logger::DEBUG
|
31
|
-
skin = Slimmer::Skin.new options[:asset_host], false, :
|
30
|
+
skin = Slimmer::Skin.new options[:asset_host], false, logger: logger
|
32
31
|
static_error = skin.error nil, options[:template], Nokogiri::HTML("").to_html
|
33
32
|
|
34
|
-
if options[:file] ==
|
33
|
+
if options[:file] == "-"
|
35
34
|
STDOUT.print static_error
|
36
35
|
else
|
37
|
-
File.open options[:file],
|
36
|
+
File.open options[:file], "w" do |f|
|
38
37
|
f.print static_error
|
39
38
|
end
|
40
39
|
end
|
data/lib/slimmer.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "nokogiri"
|
2
|
+
require "erb"
|
3
|
+
require "plek"
|
4
|
+
require "null_logger"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "slimmer/version"
|
7
|
+
require "slimmer/railtie" if defined? Rails
|
8
8
|
|
9
9
|
module Slimmer
|
10
|
-
CACHE_TTL =
|
10
|
+
CACHE_TTL = 60
|
11
11
|
|
12
12
|
def self.cache
|
13
13
|
@cache ||= defined?(Rails) ? Rails.cache : NoCache.new
|
@@ -19,36 +19,29 @@ module Slimmer
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
autoload :Railtie,
|
23
|
-
autoload :Skin,
|
22
|
+
autoload :Railtie, "slimmer/railtie"
|
23
|
+
autoload :Skin, "slimmer/skin"
|
24
24
|
|
25
|
-
autoload :Template,
|
26
|
-
autoload :App,
|
27
|
-
autoload :Headers,
|
28
|
-
autoload :HTTPClient,
|
29
|
-
|
30
|
-
autoload :GovukComponents, 'slimmer/govuk_components'
|
31
|
-
autoload :LocalGovukComponents, 'slimmer/local_govuk_components'
|
32
|
-
autoload :ComponentResolver, 'slimmer/component_resolver'
|
33
|
-
autoload :NetworkComponentResolver, 'slimmer/network_component_resolver'
|
34
|
-
autoload :LocalComponentResolver, 'slimmer/local_component_resolver'
|
35
|
-
autoload :I18nBackend, 'slimmer/i18n_backend'
|
25
|
+
autoload :Template, "slimmer/template"
|
26
|
+
autoload :App, "slimmer/app"
|
27
|
+
autoload :Headers, "slimmer/headers"
|
28
|
+
autoload :HTTPClient, "slimmer/http_client"
|
36
29
|
|
37
30
|
module Processors
|
38
|
-
autoload :BodyClassCopier,
|
39
|
-
autoload :BodyInserter,
|
40
|
-
autoload :ConditionalCommentMover,
|
41
|
-
autoload :FooterRemover,
|
42
|
-
autoload :MetadataInserter,
|
43
|
-
autoload :HeaderContextInserter,
|
44
|
-
autoload :InsideHeaderInserter,
|
45
|
-
autoload :NavigationMover,
|
46
|
-
autoload :SearchIndexSetter,
|
47
|
-
autoload :SearchPathSetter,
|
48
|
-
autoload :SearchParameterInserter,
|
49
|
-
autoload :SearchRemover,
|
50
|
-
autoload :TagMover,
|
51
|
-
autoload :TitleInserter,
|
31
|
+
autoload :BodyClassCopier, "slimmer/processors/body_class_copier"
|
32
|
+
autoload :BodyInserter, "slimmer/processors/body_inserter"
|
33
|
+
autoload :ConditionalCommentMover, "slimmer/processors/conditional_comment_mover"
|
34
|
+
autoload :FooterRemover, "slimmer/processors/footer_remover"
|
35
|
+
autoload :MetadataInserter, "slimmer/processors/metadata_inserter"
|
36
|
+
autoload :HeaderContextInserter, "slimmer/processors/header_context_inserter"
|
37
|
+
autoload :InsideHeaderInserter, "slimmer/processors/inside_header_inserter"
|
38
|
+
autoload :NavigationMover, "slimmer/processors/navigation_mover"
|
39
|
+
autoload :SearchIndexSetter, "slimmer/processors/search_index_setter"
|
40
|
+
autoload :SearchPathSetter, "slimmer/processors/search_path_setter"
|
41
|
+
autoload :SearchParameterInserter, "slimmer/processors/search_parameter_inserter"
|
42
|
+
autoload :SearchRemover, "slimmer/processors/search_remover"
|
43
|
+
autoload :TagMover, "slimmer/processors/tag_mover"
|
44
|
+
autoload :TitleInserter, "slimmer/processors/title_inserter"
|
52
45
|
end
|
53
46
|
|
54
47
|
class TemplateNotFoundException < StandardError; end
|
data/lib/slimmer/app.rb
CHANGED
@@ -1,23 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require "slimmer/govuk_request_id"
|
2
2
|
|
3
3
|
module Slimmer
|
4
4
|
class App
|
5
5
|
attr_accessor :logger
|
6
6
|
|
7
|
-
def initialize(app, *args
|
7
|
+
def initialize(app, *args)
|
8
8
|
options = args.first || {}
|
9
9
|
@app = app
|
10
10
|
|
11
11
|
logger = options[:logger] || NullLogger.instance
|
12
12
|
self.logger = logger
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
self.logger.level = 1 # info
|
18
|
-
end
|
13
|
+
if logger&.level&.zero? # Log set to debug level
|
14
|
+
unless options[:enable_debugging]
|
15
|
+
self.logger = logger.dup
|
16
|
+
self.logger.level = 1 # info
|
19
17
|
end
|
20
|
-
rescue NoMethodError # In case logger doesn't respond_to? :level
|
21
18
|
end
|
22
19
|
|
23
20
|
if options.key? :template_path
|
@@ -55,12 +52,12 @@ module Slimmer
|
|
55
52
|
end
|
56
53
|
|
57
54
|
def in_development?
|
58
|
-
ENV[
|
55
|
+
ENV["RAILS_ENV"] == "development"
|
59
56
|
end
|
60
57
|
|
61
58
|
def skip_slimmer_param?(env)
|
62
|
-
skip = Rack::Request.new(env).params[
|
63
|
-
skip
|
59
|
+
skip = Rack::Request.new(env).params["skip_slimmer"]
|
60
|
+
skip && skip.to_i.positive?
|
64
61
|
end
|
65
62
|
|
66
63
|
def skip_slimmer_header?(response)
|
@@ -69,8 +66,9 @@ module Slimmer
|
|
69
66
|
|
70
67
|
def s(body)
|
71
68
|
return body.to_s unless body.respond_to?(:each)
|
69
|
+
|
72
70
|
b = ""
|
73
|
-
body.each {|a| b << a }
|
71
|
+
body.each { |a| b << a }
|
74
72
|
b
|
75
73
|
end
|
76
74
|
|
@@ -84,30 +82,30 @@ module Slimmer
|
|
84
82
|
request = Rack::Request.new(env)
|
85
83
|
|
86
84
|
# Store the request id so it can be passed on with any template requests
|
87
|
-
GovukRequestId.value = env[
|
85
|
+
GovukRequestId.value = env["HTTP_GOVUK_REQUEST_ID"]
|
88
86
|
|
89
87
|
rewritten_body = case response.status
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
when 200
|
89
|
+
@skin.success request, response, s(response.body)
|
90
|
+
when 403
|
91
|
+
@skin.error "403", s(response.body), request.env
|
92
|
+
when 404
|
93
|
+
@skin.error "404", s(response.body), request.env
|
94
|
+
when 410
|
95
|
+
@skin.error "410", s(response.body), request.env
|
96
|
+
else
|
97
|
+
@skin.error "500", s(response.body), request.env
|
98
|
+
end
|
101
99
|
|
102
100
|
rewritten_body = [rewritten_body] unless rewritten_body.respond_to?(:each)
|
103
101
|
response.body = rewritten_body
|
104
|
-
response.headers[
|
102
|
+
response.headers["Content-Length"] = content_length(response.body)
|
105
103
|
|
106
104
|
response.finish
|
107
105
|
end
|
108
106
|
|
109
107
|
def strip_slimmer_headers(headers)
|
110
|
-
headers.reject {|k,
|
108
|
+
headers.reject { |k, _v| k =~ /\A#{Headers::HEADER_PREFIX}/ }
|
111
109
|
end
|
112
110
|
end
|
113
111
|
end
|
data/lib/slimmer/cucumber.rb
CHANGED
data/lib/slimmer/headers.rb
CHANGED
@@ -5,7 +5,7 @@ module Slimmer
|
|
5
5
|
InvalidHeader = Class.new(RuntimeError)
|
6
6
|
|
7
7
|
# @private
|
8
|
-
HEADER_PREFIX = "X-Slimmer"
|
8
|
+
HEADER_PREFIX = "X-Slimmer".freeze
|
9
9
|
|
10
10
|
# @private
|
11
11
|
SLIMMER_HEADER_MAPPING = {
|
@@ -20,40 +20,40 @@ module Slimmer
|
|
20
20
|
skip: "Skip",
|
21
21
|
template: "Template",
|
22
22
|
remove_search: "Remove-Search",
|
23
|
-
}
|
23
|
+
}.freeze
|
24
24
|
|
25
25
|
# @private
|
26
|
-
APPLICATION_NAME_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:application_name]}"
|
26
|
+
APPLICATION_NAME_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:application_name]}".freeze
|
27
27
|
|
28
28
|
# @private
|
29
|
-
FORMAT_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:format]}"
|
29
|
+
FORMAT_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:format]}".freeze
|
30
30
|
|
31
31
|
# @private
|
32
|
-
ORGANISATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:organisations]}"
|
32
|
+
ORGANISATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:organisations]}".freeze
|
33
33
|
|
34
34
|
# @private
|
35
|
-
WORLD_LOCATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:world_locations]}"
|
35
|
+
WORLD_LOCATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:world_locations]}".freeze
|
36
36
|
|
37
37
|
# @private
|
38
|
-
PAGE_OWNER_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:page_owner]}"
|
38
|
+
PAGE_OWNER_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:page_owner]}".freeze
|
39
39
|
|
40
40
|
# @private
|
41
|
-
RESULT_COUNT_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:result_count]}"
|
41
|
+
RESULT_COUNT_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:result_count]}".freeze
|
42
42
|
|
43
43
|
# @private
|
44
|
-
SEARCH_PATH_HEADER = "#{HEADER_PREFIX}-Search-Path"
|
44
|
+
SEARCH_PATH_HEADER = "#{HEADER_PREFIX}-Search-Path".freeze
|
45
45
|
|
46
46
|
# @private
|
47
|
-
SEARCH_PARAMETERS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:search_parameters]}"
|
47
|
+
SEARCH_PARAMETERS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:search_parameters]}".freeze
|
48
48
|
|
49
49
|
# @private
|
50
|
-
SKIP_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:skip]}"
|
50
|
+
SKIP_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:skip]}".freeze
|
51
51
|
|
52
52
|
# @private
|
53
|
-
TEMPLATE_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:template]}"
|
53
|
+
TEMPLATE_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:template]}".freeze
|
54
54
|
|
55
55
|
# @private
|
56
|
-
REMOVE_SEARCH_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:remove_search]}"
|
56
|
+
REMOVE_SEARCH_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:remove_search]}".freeze
|
57
57
|
|
58
58
|
# Set the "slimmer headers" to configure the page
|
59
59
|
#
|
@@ -71,6 +71,7 @@ module Slimmer
|
|
71
71
|
# @option hash [String] world_locations
|
72
72
|
def set_slimmer_headers(hash)
|
73
73
|
raise InvalidHeader if (hash.keys - SLIMMER_HEADER_MAPPING.keys).any?
|
74
|
+
|
74
75
|
SLIMMER_HEADER_MAPPING.each do |hash_key, header_suffix|
|
75
76
|
value = hash[hash_key]
|
76
77
|
headers["#{HEADER_PREFIX}-#{header_suffix}"] = value.to_s if value
|