# File actionpack/lib/action_dispatch/routing/mapper.rb, line 605
def mount(app = nil, deprecated_options = nil, as: DEFAULT, via: nil, at: nil, defaults: nil, constraints: nil, anchor: false, format: false, path: nil, internal: nil, **mapping, &block)
if deprecated_options.is_a?(Hash)
as = assign_deprecated_option(deprecated_options, :as, :mount) if deprecated_options.key?(:as)
via ||= assign_deprecated_option(deprecated_options, :via, :mount)
at ||= assign_deprecated_option(deprecated_options, :at, :mount)
defaults ||= assign_deprecated_option(deprecated_options, :defaults, :mount)
constraints ||= assign_deprecated_option(deprecated_options, :constraints, :mount)
anchor = assign_deprecated_option(deprecated_options, :anchor, :mount) if deprecated_options.key?(:anchor)
format = assign_deprecated_option(deprecated_options, :format, :mount) if deprecated_options.key?(:format)
path ||= assign_deprecated_option(deprecated_options, :path, :mount)
internal ||= assign_deprecated_option(deprecated_options, :internal, :mount)
assign_deprecated_options(deprecated_options, mapping, :mount)
end
path_or_action = at
if app.nil?
hash_app, hash_path = mapping.find { |key, _| key.respond_to?(:call) }
mapping.delete(hash_app) if hash_app
app ||= hash_app
path_or_action ||= hash_path
end
raise ArgumentError, "A rack application must be specified" unless app.respond_to?(:call)
raise ArgumentError, <<~MSG unless path_or_action
Must be called with mount point
mount SomeRackApp, at: "some_route"
or
mount(SomeRackApp => "some_route")
MSG
rails_app = rails_app? app
as = app_name(app, rails_app) if as == DEFAULT
target_as = name_for_action(as, path_or_action)
via ||= :all
match(path_or_action, to: app, as,, via,, defaults,, constraints,, anchor,, format,, path,, internal,, **mapping, &block)
define_generate_prefix(app, target_as) if rails_app
self
end