class Sinatra::Base
Public Instance Methods
old_route_eval()
we monkey patch here because at this point we know the name of the route
Alias for: route_eval
route_eval() { || ... }
click to toggle source
# File lib/sinatra/chiro/monkey_patch.rb, line 5 def route_eval show_help if params.has_key? "help" validate_parameters if self.class.respond_to?(:validator) old_route_eval { yield } end
Also aliased as: old_route_eval
show_help()
click to toggle source
# File lib/sinatra/chiro/monkey_patch.rb, line 23 def show_help if self.class.respond_to?(:validator) status 200 erb_file = settings.erb_file views = settings.views_location throw :halt, "#{erb(erb_file, {:views => views}, :endpoint => self.class.documentation.document(env)) }" end end
validate_parameters()
click to toggle source
# File lib/sinatra/chiro/monkey_patch.rb, line 12 def validate_parameters error = self.class.validator.validate(params, env) if error == "not found" status 404 throw :halt, "Path not found" elsif error!= nil status 403 throw :halt, "#{error}" end end