Method: Hanami::Middleware::Trie#add

Defined in:
lib/hanami/middleware/trie.rb

#add(path, app) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



28
29
30
31
32
33
34
35
# File 'lib/hanami/middleware/trie.rb', line 28

def add(path, app)
  node = @root
  for_each_segment(path) do |segment|
    node = node.put(segment)
  end

  node.app!(app)
end