Class: Hanami::Slice::RoutesHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/slice/routes_helper.rb

Overview

Hanami app routes helpers

An instance of this class will be registered with slice (at the “routes” key). You can use it to access the route helpers for your app.

Examples:

MyApp::App["routes"].path(:root) # => "/"

See Also:

  • Router::UrlHelpers

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(router) ⇒ RoutesHelper

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.

Returns a new instance of RoutesHelper.

Since:

  • 2.0.0



18
19
20
# File 'lib/hanami/slice/routes_helper.rb', line 18

def initialize(router)
  @router = router
end

Instance Method Details

#pathObject

See Also:

  • Router::UrlHelpers#path

Since:

  • 2.0.0



23
24
25
# File 'lib/hanami/slice/routes_helper.rb', line 23

def path(...)
  router.path(...)
end

#urlObject

See Also:

  • Router::UrlHelpers#url

Since:

  • 2.0.0



28
29
30
# File 'lib/hanami/slice/routes_helper.rb', line 28

def url(...)
  router.url(...)
end