Sha256: 1905fdf542b4c836f00cc5907bae139bd41283d8f6047dcb42ce91c6c56c8074
Contents?: true
Size: 664 Bytes
Versions: 70
Compression:
Stored size: 664 Bytes
Contents
require 'rubygems' require 'bundler/setup' require 'mime/types' module RubyApp module Mixins module RouteMixin GET = 'GET' POST = 'POST' def route(method, pattern, &block) self.routes << { :method => method, :pattern => pattern, :block => block } end def do_route(method, path) self.routes.each do |route| if method == route[:method] and path =~ route[:pattern] return route[:block].call([method].concat($~.to_a)) end end end def routes @_routes ||= [] end def clear_routes self.routes.clear end end end end
Version data entries
70 entries across 70 versions & 1 rubygems