Class: GovukTechDocs::Redirects
- Inherits:
-
Object
- Object
- GovukTechDocs::Redirects
- Defined in:
- lib/govuk_tech_docs/redirects.rb
Constant Summary collapse
- LEADING_SLASH =
%r{\A/}
Instance Method Summary collapse
-
#initialize(context) ⇒ Redirects
constructor
A new instance of Redirects.
- #redirects ⇒ Object
Constructor Details
#initialize(context) ⇒ Redirects
Returns a new instance of Redirects.
5 6 7 |
# File 'lib/govuk_tech_docs/redirects.rb', line 5 def initialize(context) @context = context end |
Instance Method Details
#redirects ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/govuk_tech_docs/redirects.rb', line 9 def redirects all_redirects = redirects_from_config + redirects_from_frontmatter all_redirects.map do |from, to| # Middleman needs paths without leading slashes [from.sub(LEADING_SLASH, ""), { to: to.sub(LEADING_SLASH, "") }] end end |