module Roda::RodaPlugins::HashBranches::ClassMethods
def freeze
def freeze opts[:hash_branches].freeze.each_value(&:freeze) super end
def hash_branch(namespace='', segment, &block)
Add branch handler for the given namespace and segment. If called without
def hash_branch(namespace='', segment, &block) segment = "/#{segment}" routes = opts[:hash_branches][namespace] ||= {} if block routes[segment] = define_roda_method(routes[segment] || "hash_branch_#{namespace}_#{segment}", 1, &convert_route_block(block)) elsif meth = routes.delete(segment) remove_method(meth) end end
def inherited(subclass)
def inherited(subclass) super h = subclass.opts[:hash_branches] opts[:hash_branches].each do |namespace, routes| h[namespace] = routes.dup end end