Skip to content

Commit ac8cb0b

Browse files
committed
add support for with_content
https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc ^ Was JUST enough context for me to figure this out!
1 parent 74d41d2 commit ac8cb0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rubocop/cop/github/render_literal_helpers.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ module RenderLiteralHelpers
2828
(send nil? {:render :render_to_string} (send _ :new ...) ...)
2929
PATTERN
3030

31+
def_node_matcher :render_view_component_instance_with_content?, <<-PATTERN
32+
(send nil? {:render :render_to_string} (send (send _ :new ...) `:with_content ...))
33+
PATTERN
34+
3135
def_node_matcher :render_view_component_collection?, <<-PATTERN
3236
(send nil? {:render :render_to_string} (send _ :with_collection ...) ...)
3337
PATTERN
@@ -41,7 +45,8 @@ def hash_with_literal_keys?(hash)
4145
end
4246

4347
def render_view_component?(node)
44-
render_view_component_instance?(node) ||
48+
render_view_component_instance_with_content?(node) ||
49+
render_view_component_instance?(node) ||
4550
render_view_component_collection?(node)
4651
end
4752
end

0 commit comments

Comments
 (0)