module Roda::RodaPlugins::Halt::RequestMethods
Public Instance Methods
halt(*res)
click to toggle source
Expand default halt method to handle status codes, headers, and bodies. See Halt
.
Calls superclass method
# File lib/roda/plugins/halt.rb, line 41 def halt(*res) case res.length when 0 # do nothing when 1 case v = res[0] when Integer response.status = v when String response.write v when Array throw :halt, v else raise Roda::RodaError, "singular argument to #halt must be Integer, String, or Array" end when 2 response.status = res[0] response.write res[1] when 3 response.status = res[0] response.headers.merge!(res[1]) response.write res[2] else raise Roda::RodaError, "too many arguments given to #halt (accepts 0-3, received #{res.length})" end super() end