Public Instance methods
freeze()
Freeze the hash_paths metadata when freezing the app.
[show source]
# File lib/roda/plugins/hash_paths.rb 86 def freeze 87 hash_paths.freeze.each_value(&:freeze) 88 super 89 end
hash_path(namespace='', path, &block)
Add path handler for the given namespace and path. When the r.hash_paths method is called, checks the matching namespace for the full remaining path, and dispatch to that block if there is one. If called without a block, removes the existing path handler if it exists.
[show source]
# File lib/roda/plugins/hash_paths.rb 106 def hash_path(namespace='', path, &block) 107 routes = hash_paths[namespace] ||= {} 108 if block 109 routes[path] = define_roda_method(routes[path] || "hash_path_#{namespace}_#{path}", 1, &convert_route_block(block)) 110 elsif meth = routes.delete(path) 111 remove_method(meth) 112 end 113 end
inherited(subclass)
Duplicate hash_paths metadata in subclass.
[show source]
# File lib/roda/plugins/hash_paths.rb 92 def inherited(subclass) 93 super 94 95 h = subclass.hash_paths 96 hash_paths.each do |namespace, routes| 97 h[namespace] = routes.dup 98 end 99 end