Sha256: 58c3d12eeaa9f2bf49ef7a1560b832093ef2d94d2d3b4d771c3500310b004ffb
Contents?: true
Size: 597 Bytes
Versions: 2
Compression:
Stored size: 597 Bytes
Contents
require 'ruby-debug' module Inkling module Routing class TypeConstraint attr_accessor :type def initialize(type, prefix = nil) @type = type @prefix = prefix end def matches?(request) path = @prefix.nil? ? request.path : request.path.gsub(@prefix, "") matching_path = Inkling::Path.find_by_slug(path) if matching_path result = matching_path.content.is_a? @type.constantize request.params[:id] = matching_path.content.id result else false end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inkling-0.0.4 | lib/inkling/routing.rb |
inkling-0.0.3a | lib/inkling/routing.rb |