Skip to content

Commit 450dfd1

Browse files
committed
Refactor respond_to to method_defined
1 parent d485468 commit 450dfd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/view_component/slotable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def renders_many(slot_name, callable = nil)
168168

169169
define_method :"with_#{slot_name}" do |collection_args = nil, &block|
170170
collection_args.map do |args|
171-
if args.respond_to?(:to_hash)
171+
if args.class.method_defined?(:to_hash)
172172
set_slot(slot_name, nil, **args, &block)
173173
else
174174
set_slot(slot_name, nil, *args, &block)

0 commit comments

Comments
 (0)