Module: RuboCop::Cop::GitHub::RenderLiteralHelpers

Extended by:
NodePattern::Macros
Included in:
RailsControllerRenderLiteral, RailsViewRenderLiteral
Defined in:
lib/rubocop/cop/github/render_literal_helpers.rb

Instance Method Summary collapse

Instance Method Details

#hash_with_literal_keys?(hash) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
# File 'lib/rubocop/cop/github/render_literal_helpers.rb', line 43

def hash_with_literal_keys?(hash)
  hash.children.all? { |child| child.pair_type? } &&
    hash.pairs.all? { |pair| literal?(pair.key) }
end

#render_view_component?(node) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/rubocop/cop/github/render_literal_helpers.rb', line 48

def render_view_component?(node)
  render_view_component_instance_with_content?(node) ||
    render_view_component_instance?(node) ||
    render_view_component_collection?(node)
end