Sha256: cef73d601088bee87bc91aae87a1edc2b314df7a5284cc609123913661b5f309
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
class Usher module Interface class Rack # Route specific for Rack with redirection support built in. class Route < Usher::Route # Redirect route to some other path. def redirect(path, status = 302) unless (300..399).include?(status) raise ArgumentError, "Status has to be an integer between 300 and 399" end to { |env| params = env[Usher::Interface::Rack::ENV_KEY_PARAMS] response = ::Rack::Response.new response.redirect(eval(%|"#{path}"|), status) response.finish } self end def serves_static_from(root) match_partially! @destination = ::Rack::File.new(root) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
usher-0.8.0 | lib/usher/interface/rack/route.rb |
usher-0.7.5 | lib/usher/interface/rack/route.rb |