Sha256: fb5bc94b6b25a4bc880461120d5518a9ed673bf417b9c79d11531aa7ef5e55ec
Contents?: true
Size: 1015 Bytes
Versions: 8
Compression:
Stored size: 1015 Bytes
Contents
# frozen_string_literal: true module Hanami class Application module Routing class Resolver # Endpoint resolver node to register slices in a tree # # @api private # @since 2.0.0 class Node # @api private # @since 2.0.0 attr_reader :slice # @api private # @since 2.0.0 def initialize @slice = nil @children = {} end # @api private # @since 2.0.0 def put(segment) @children[segment] ||= self.class.new end # @api private # @since 2.0.0 def get(segment) @children.fetch(segment) { self if leaf? } end # @api private # @since 2.0.0 def leaf!(slice) @slice = slice end # @api private # @since 2.0.0 def leaf? @slice end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems