123456789_123456789_123456789_123456789_123456789_

Module: RuboCop::Cop::DigHelp

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Macros
Defined in: lib/rubocop/cop/mixin/dig_help.rb

Overview

Help methods for working with Enumerable#dig in cops. Used by Style::DigChain and Style::SingleArgumentDig

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#dig_chain_enabled?Boolean (readonly, private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/dig_help.rb', line 22

def dig_chain_enabled?
  @config.cop_enabled?('Style/DigChain')
end

Instance Method Details

#dig?(node)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/dig_help.rb', line 11

def_node_matcher :dig?, <<~PATTERN
  (call _ :dig !{hash block_pass}+)
PATTERN

#single_argument_dig?(node)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/dig_help.rb', line 16

def_node_matcher :single_argument_dig?, <<~PATTERN
  (send _ :dig $!splat)
PATTERN