Skip to content

Commit c5f8043

Browse files
committed
Check explicitly variable matches the class instead of implicit #respond_to?
1 parent 4bc9dd0 commit c5f8043

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/js_routes/instance.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def routes_list
185185
sig { params(route: JourneyRoute).returns(T::Array[StringArray]) }
186186
def mounted_app_routes(route)
187187
rails_engine_app = T.unsafe(app_from_route(route))
188-
if rails_engine_app.respond_to?(:superclass) &&
189-
rails_engine_app.superclass == Rails::Engine && !route.path.anchored
188+
if rails_engine_app.is_a?(Class) &&
189+
rails_engine_app < Rails::Engine && !route.path.anchored
190190
rails_engine_app.routes.named_routes.flat_map do |_, engine_route|
191191
route_helpers_if_match(engine_route, route)
192192
end
@@ -198,9 +198,9 @@ def mounted_app_routes(route)
198198
sig { params(route: JourneyRoute).returns(T.untyped) }
199199
def app_from_route(route)
200200
app = route.app
201-
# rails engine in Rails 4.2 use additional
201+
# Rails Engine can use additional
202202
# ActionDispatch::Routing::Mapper::Constraints, which contain app
203-
if app.respond_to?(:app) && app.respond_to?(:constraints)
203+
if app.is_a?(ActionDispatch::Routing::Mapper::Constraints)
204204
app.app
205205
else
206206
app

0 commit comments

Comments
 (0)