Sha256: eb2abb108527aaa5771d5b7e260b9216056a11d7f6db22defc0ec2acfa183ae2
Contents?: true
Size: 716 Bytes
Versions: 1
Compression:
Stored size: 716 Bytes
Contents
module Pakyow # Handles looking up paths for named routes and populating # the path with data. # class RouteLookup include Helpers def path(name, data = nil) route = self.get_named_route(name) data ? self.populate(route, data) : File.join('/', route[4]) end def group(name) @group = name self end protected def get_named_route(name) Pakyow.app.router.route(name, @group) || [] end def populate(route, data = {}) vars = route[1] split_path = Request.split_url(route[4]) vars.each {|v| split_path[v[:position]] = data[v[:var]] } File.join('/', split_path.join('/')) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pakyow-core-0.8rc1 | pakyow-core/lib/core/route_lookup.rb |