Sha256: 2f8d53e5ee89c3d7b8f9892a415793301d46e82ccef09735210a89ee8e02deda
Contents?: true
Size: 611 Bytes
Versions: 153
Compression:
Stored size: 611 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 return @_routes ||= [] end end end end
Version data entries
153 entries across 153 versions & 1 rubygems