module Roda::RodaPlugins::HashBranches::ClassMethods

def freeze

Freeze the hash_branches metadata when freezing the app.
def freeze
  opts[:hash_branches].freeze.each_value(&:freeze)
  super
end

def hash_branch(namespace='', segment, &block)

a block, removes the existing branch handler if it exists.
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)

Duplicate hash_branches metadata in subclass.
def inherited(subclass)
  super
  h = subclass.opts[:hash_branches]
  opts[:hash_branches].each do |namespace, routes|
    h[namespace] = routes.dup
  end
end