Module: Jets::Router::Dsl::Mount

Included in:
Jets::Router::Dsl
Defined in:
lib/jets/router/dsl/mount.rb

Instance Method Summary collapse

Instance Method Details

#mount(klass, at:) ⇒ Object

The mounted class must be a Rack compatiable class



4
5
6
7
8
9
10
11
# File 'lib/jets/router/dsl/mount.rb', line 4

def mount(klass, at:)
  options = {to: "jets/mount#call", mount_class: klass}
  at = at[1..-1] if at.starts_with?('/') # be more forgiving if / accidentally included
  at_wildcard = at.blank? ? "*path" : "#{at}/*path"

  any at, options
  any at_wildcard, options
end