sinatra
lissanwen
这个作者很懒,什么都没留下…
展开
-
Sinatra::Request#process_route(pattern, keys, conditions)
# If the current request matches pattern and conditions, fill params # with keys and call the given block. # Revert params afterwards. # # Returns pass block. def proc...原创 2011-08-26 10:58:58 · 70 阅读 · 0 评论 -
sinatra snippets
1214 # Use the specified Rack middleware 1215 def use(middleware, *args, &block) 1216 @prototype = nil=> 1217 @middleware原创 2011-08-26 11:43:51 · 65 阅读 · 0 评论 -
Sinatra::Base#compile!
1140 def compile!(verb, path, block, options = {})1141 options.each_pair { |option, args| send(option, *args) }1142 method_name = "#{verb} #{path}"1143 1144 defin...原创 2011-09-07 16:38:46 · 78 阅读 · 0 评论 -
Sinatra::Base#get
1107 # Defining a `GET` handler also automatically defines1108 # a `HEAD` handler.1109 def get(path, opts={}, &block) 1110 conditions = @conditions.dup 1111 r...原创 2011-09-08 10:53:43 · 78 阅读 · 0 评论 -
Sinatra::Base#helpers
1185 public 1186 # Makes the methods defined in the block and in the Modules given 1187 # in `extensions` available to the handlers and templates 1188 def helpe...原创 2011-09-09 10:47:54 · 76 阅读 · 0 评论 -
def route(verb, path, options={}, &block) rake routes
path => "/hi/:ba" block, pattern, keys, conditions = compile! verb, path, block, options pattern => /^\/hi\/([^\/?#]+)$/22: self = Sinatra::Application(rdb:1) disp self.routes23: self.route...原创 2011-08-14 22:16:09 · 170 阅读 · 0 评论 -
sinatra tips
request.env = {"GATEWAY_INTERFACE"=>"CGI/1.1", "PATH_INFO"=>"/requests/4eccb0b4931a5621dd000001/fulfill", "QUERY_STRING"=>"request%5Bstatus%5D=done&request%5Bcomment_body%5D=done+body&quo原创 2011-11-23 17:26:55 · 79 阅读 · 0 评论