module Roda::RodaPlugins::HashBranchViewSubdir::ClassMethods

def freeze

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

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

dispatching to the original block.
by modifying the generated method to append the view subdirectory before
Automatically append a view subdirectory for a successful hash_branch route,
def hash_branch(namespace='', segment, &block)
  meths = opts[:hash_branch_view_subdir_methods][namespace] ||= {}
  if block
    meth = meths[segment] = define_roda_method(meths[segment] || "_hash_branch_view_subdir_#{namespace}_#{segment}", 1, &convert_route_block(block))
    super do |*_|
      append_view_subdir(segment)
      send(meth, @_request)
    end
  else
    if meth = meths.delete(segment)
      remove_method(meth)
    end
    super
  end
end

def inherited(subclass)

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