base.rb
block in route
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block in route
define_method "#{verb} #{path}", &block
unbound_method = instance_method("#{verb} #{path}")
block =
if block.arity != 0
lambda { unbound_method.bind(self).call(*@block_params) }
else
lambda { unbound_method.bind(self).call }
end
invoke_hook(:route_added, verb, path, block)
(routes[verb] ||= []).
push([pattern, keys, conditions, block]).last
end
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
instance_eval
end
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval(&block)
throw :halt, instance_eval(&block)
end
# No matching route was found or all routes passed. The default
# implementation is to forward the request downstream when running
# as middleware (@app is non-nil); when no downstream app is set, raise
# a NotFound exception. Subclasses can override this method to perform
# custom route miss logic.
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
route_eval
end
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval(&block)
throw :halt, instance_eval(&block)
end
# No matching route was found or all routes passed. The default
# implementation is to forward the request downstream when running
# as middleware (@app is non-nil); when no downstream app is set, raise
# a NotFound exception. Subclasses can override this method to perform
# custom route miss logic.
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block (2 levels) in route!
end
@params = original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
route_eval(&block)
end
end
end
end
route_missing
end
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
catch
{'captures' => values}
else
{}
end
@params = original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
route_eval(&block)
end
end
end
end
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block in route!
{'captures' => values}
else
{}
end
@params = original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
route_eval(&block)
end
end
end
end
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
each
self.class.filters.each { |block| instance_eval(&block) }
# routes
if routes = self.class.routes[@request.request_method]
original_params = @params
path = unescape(@request.path_info)
routes.each do |pattern, keys, conditions, block|
if match = pattern.match(path)
values = match.captures.to_a
params =
if keys.any?
keys.zip(values).inject({}) do |hash,(k,v)|
if k == 'splat'
(hash[k] ||= []) << v
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
route!
self.class.filters.each { |block| instance_eval(&block) }
# routes
if routes = self.class.routes[@request.request_method]
original_params = @params
path = unescape(@request.path_info)
routes.each do |pattern, keys, conditions, block|
if match = pattern.match(path)
values = match.captures.to_a
params =
if keys.any?
keys.zip(values).inject({}) do |hash,(k,v)|
if k == 'splat'
(hash[k] ||= []) << v
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
dispatch!
end
res
end
# Dispatch a request with error handling.
def dispatch!
route!
rescue NotFound => boom
handle_not_found!(boom)
rescue ::Exception => boom
handle_exception!(boom)
end
def handle_not_found!(boom)
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block in call!
def call!(env)
@env = env
@request = Request.new(env)
@response = Response.new
@params = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
status, header, body = @response.finish
# Never produce a body on HEAD requests. Do retain the Content-Length
# unless it's "0", in which case we assume it was calculated erroneously
# for a manual HEAD response and remove it entirely.
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
instance_eval
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block in invoke
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
catch
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
invoke
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/home/users/1/littlestar.jp-scl/web/lib/sinatra/compat.rb
in
invoke
super(engine, template, options, locals, &bk)
end
# Throwing halt with a Symbol and the to_result convention are
# deprecated. Override the invoke method to detect those types of return
# values.
def invoke(&block) #:nodoc:
res = super
case
when res.kind_of?(Symbol)
sinatra_warn "Invoking the :#{res} helper by returning a Symbol is deprecated;",
"call the helper directly instead."
@response.body = __send__(res)
when res.respond_to?(:to_result)
sinatra_warn "The to_result convention is deprecated."
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
call!
def call!(env)
@env = env
@request = Request.new(env)
@response = Response.new
@params = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
status, header, body = @response.finish
# Never produce a body on HEAD requests. Do retain the Content-Length
# unless it's "0", in which case we assume it was calculated erroneously
# for a manual HEAD response and remove it entirely.
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
call
def initialize(app=nil)
@app = app
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
attr_accessor :env, :request, :response, :params
def call!(env)
@env = env
@request = Request.new(env)
/home/users/1/littlestar.jp-scl/web/lib/rack/showexceptions.rb
in
call
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
end
def call(env)
@app.call(env)
rescue StandardError, LoadError, SyntaxError => e
backtrace = pretty(env, e)
[500,
{"Content-Type" => "text/html",
"Content-Length" => backtrace.join.size.to_s},
backtrace]
end
/home/users/1/littlestar.jp-scl/web/lib/rack/methodoverride.rb
in
call
method = method.to_s.upcase
if HTTP_METHODS.include?(method)
env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
env["REQUEST_METHOD"] = method
end
end
@app.call(env)
end
end
end
/home/users/1/littlestar.jp-scl/web/lib/rack/commonlogger.rb
in
_call
dup._call(env)
end
def _call(env)
@env = env
@logger ||= self
@time = Time.now
@status, @header, @body = @app.call(env)
[@status, @header, self]
end
def close
@body.close if @body.respond_to? :close
end
/home/users/1/littlestar.jp-scl/web/lib/rack/commonlogger.rb
in
call
class CommonLogger
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
dup._call(env)
end
def _call(env)
@env = env
@logger ||= self
@time = Time.now
@status, @header, @body = @app.call(env)
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
block in call
@middleware.each { |c,a,b| builder.use(c, *a, &b) }
builder.run super
builder.to_app
end
def call(env)
synchronize { prototype.call(env) }
end
def reset!(base=superclass)
@routes = base.dupe_routes
@templates = base.templates.dup
@conditions = []
@filters = base.filters.dup
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
synchronize
end
@@mutex = Mutex.new
def synchronize(&block)
if lock?
@@mutex.synchronize(&block)
else
yield
end
end
def metadef(message, &block)
(class << self; self; end).
send :define_method, message, &block
end
/home/users/1/littlestar.jp-scl/web/lib/sinatra/base.rb
in
call
@middleware.each { |c,a,b| builder.use(c, *a, &b) }
builder.run super
builder.to_app
end
def call(env)
synchronize { prototype.call(env) }
end
def reset!(base=superclass)
@routes = base.dupe_routes
@templates = base.templates.dup
@conditions = []
@filters = base.filters.dup
/home/users/1/littlestar.jp-scl/web/lib/rack/content_length.rb
in
call
include Rack::Utils
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash.new(headers)
if !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
!headers['Content-Length'] &&
!headers['Transfer-Encoding'] &&
(body.respond_to?(:to_ary) || body.respond_to?(:to_str))
/home/users/1/littlestar.jp-scl/web/lib/rack/handler/cgi.rb
in
serve
"rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
})
env["QUERY_STRING"] ||= ""
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
env["REQUEST_PATH"] ||= "/"
status, headers, body = app.call(env)
begin
send_headers status, headers
send_body body
ensure
body.close if body.respond_to? :close
end
end
/home/users/1/littlestar.jp-scl/web/lib/rack/handler/cgi.rb
in
run
require 'rack/content_length'
module Rack
module Handler
class CGI
def self.run(app, options=nil)
serve app
end
def self.serve(app)
app = ContentLength.new(app)
env = ENV.to_hash
env.delete "HTTP_CONTENT_LENGTH"
demo.cgi
in
<main>
@tenjin.render(@tmpl_name, @context)
end
set_options :run => false, :env => :development
Rack::Handler::CGI.run(Sinatra.application)
Variable | Value |
---|---|
en | "1" |
No POST data.
Variable | Value |
---|---|
CONTEXT_DOCUMENT_ROOT | /home/users/1/littlestar.jp-scl/web/morphball/ruby |
CONTEXT_PREFIX | |
DOCUMENT_ROOT | /home/users/1/littlestar.jp-scl/web/morphball/ruby |
GATEWAY_INTERFACE | CGI/1.1 |
HTTP_ACCEPT | */* |
HTTP_HOST | ruby.morphball.net |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.1 |
HTTP_X_BACKEND | lit731.phy.lolipop.lan |
HTTP_X_FORWARDED_FOR | 3.80.173.25 |
HTTP_X_FORWARDED_HOST | ruby.morphball.net |
HTTP_X_FORWARDED_PROTO | http |
NSS_SDB_USE_CACHE | YES |
PATH | /usr/local/bin:/usr/bin:/bin |
QUERY_STRING | en=1 |
REMOTE_ADDR | 3.80.173.25 |
REMOTE_PORT | 38732 |
REQUEST_METHOD | GET |
REQUEST_PATH | / |
REQUEST_SCHEME | http |
REQUEST_URI | /bluefeather/demo.cgi?en=1 |
SCRIPT_FILENAME | /home/users/1/littlestar.jp-scl/web/morphball/ruby/bluefeather/demo.cgi |
SCRIPT_NAME | /bluefeather/demo.cgi |
SERVER_ADDR | 172.19.45.134 |
SERVER_ADMIN | https://lolipop.jp/support/ |
SERVER_NAME | ruby.morphball.net |
SERVER_PORT | 80 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SIGNATURE | |
SERVER_SOFTWARE | Apache |
UNIQUE_ID | ZgZ3xnBmncjfsYv6-SseUAAAAbs |
rack.errors | #<IO:<STDERR>> |
rack.input | #<IO:<STDIN>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.form_hash | {} |
rack.request.form_input | #<IO:<STDIN>> |
rack.request.form_vars | |
rack.request.query_hash | {"en"=>"1"} |
rack.request.query_string | en=1 |
rack.run_once | true |
rack.url_scheme | http |
rack.version | [1, 0] |
sinatra.error | #<ArgumentError: wrong number of arguments (given 1, expected 0)> |
You're seeing this error because you use you have
enabled the show_exceptions
option.