Public Instance methods
hash_branches(namespace=matched_path)
Checks the matching hash_branch namespace for a branch matching the next segment in the remaining path, and dispatch to that block if there is one.
[show source]
# File lib/roda/plugins/hash_branches.rb 125 def hash_branches(namespace=matched_path) 126 rp = @remaining_path 127 128 return unless rp.getbyte(0) == 47 # "/" 129 130 if routes = roda_class.hash_branches[namespace] 131 if segment_end = rp.index('/', 1) 132 if meth = routes[rp[0, segment_end]] 133 always do 134 @remaining_path = rp[segment_end, 100000000] 135 scope.send(meth, self) 136 end 137 end 138 elsif meth = routes[rp] 139 always do 140 @remaining_path = '' 141 scope.send(meth, self) 142 end 143 end 144 end 145 end