Sha256: c38ad2b34eacbb4fe5a0a9a19018b5265972ea1bea1eef78eb6119771bcde95f
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'mustermann' module Angelo module Mustermann # hrm, sneaky # def self.included base base.extend ClassMethods base.class_eval do def_delegator :@responder, :mustermann end [Responder, WebsocketResponder].each do |res| res.class_eval do attr_accessor :mustermann end end end module ClassMethods HTTPABLE.each do |m| define_method m do |path, &block| path = ::Mustermann.new path routes[m][path] = Responder.new &block end end def routes @routes ||= {} ROUTABLE.each do |m| @routes[m] ||= RouteMap.new end @routes end end def params @params ||= super.merge mustermann.params(request.path) end class RouteMap < Hash def [] route mustermann = keys.select {|k| k.match(route)}.first responder = fetch mustermann responder.mustermann = mustermann responder end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
angelo-0.0.9 | lib/angelo/mustermann.rb |