Sha256: 47c540a4d40325f3c23426e030a5864ca754d89d6a096fbca271f20f643256b3
Contents?: true
Size: 577 Bytes
Versions: 5
Compression:
Stored size: 577 Bytes
Contents
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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
inkling-0.1.0 | lib/inkling/routing.rb |
inkling-0.0.9 | lib/inkling/routing.rb |
inkling-0.0.8 | lib/inkling/routing.rb |
inkling-0.0.7 | lib/inkling/routing.rb |
inkling-0.0.5 | lib/inkling/routing.rb |