Method: Flatrack#redirect

Defined in:
lib/flatrack.rb

#redirect(source, to: nil, type: :permanent) ⇒ Object

redirect a path

Parameters:

  • source (String)
  • to (String) (defaults to: nil)
  • type (Symbol) (defaults to: :permanent)


141
142
143
144
145
146
# File 'lib/flatrack.rb', line 141

def redirect(source, to: nil, type: :permanent)
  unless [source, to].all? { |path| path.is_a? String }
    raise ArgumentError, 'mappings must be strings'
  end
  redirects.merge! source => Redirector::Redirect.new(to, type)
end