Sha256: 04278f966841ab0bdcbf5a91e36f5e6078b154b2f14955e382eda2896bede289
Contents?: true
Size: 764 Bytes
Versions: 1
Compression:
Stored size: 764 Bytes
Contents
module Panda module Routing class Mapper attr_reader :request, :endpoints def initialize(endpoints) @endpoints = endpoints end def perform(request) @request = request path = request.path_info verb = request.request_method endpoints[verb].detect do |endpoint| match_path_with_endpoint(path, endpoint) end end private def match_path_with_endpoint(path, endpoint) regex, placeholders = endpoint[:pattern] if regex =~ path match_data = $~ placeholders.each do |placeholder| request.update_param(placeholder, match_data[placeholder]) end return true end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
panda_frwk-0.1.0 | lib/panda/routing/mapper.rb |