Sha256: dcc5b5f762ecb7dc510eaf07350b1222b4740ab3293f646d74493f3cfc20a6aa

Contents?: true

Size: 417 Bytes

Versions: 11

Compression:

Stored size: 417 Bytes

Contents

class Usher
  class Route
    # add("/index.html").redirect("/")
    def redirect(path, status = 302)
      unless (300..399).include?(status)
        raise ArgumentError, "Status has to be an integer between 300 and 399"
      end
      @destination = lambda do |env|
        response = Rack::Response.new
        response.redirect(path, status)
        response.finish
      end
      return self
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
usher-0.6.8 lib/usher/interface/rack/route.rb
usher-0.6.7 lib/usher/interface/rack/route.rb
usher-0.6.6 lib/usher/interface/rack/route.rb
usher-0.6.5 lib/usher/interface/rack/route.rb
usher-0.6.4 lib/usher/interface/rack/route.rb
usher-0.6.3 lib/usher/interface/rack/route.rb
usher-0.6.2 lib/usher/interface/rack/route.rb
usher-0.6.1 lib/usher/interface/rack/route.rb
usher-0.6.0 lib/usher/interface/rack/route.rb
usher-0.5.13 lib/usher/interface/rack/route.rb
usher-0.5.12 lib/usher/interface/rack/route.rb