Module: RuboCop::Cop::IgnoredNode
- Included in:
- Cop, Style::AlignHash
- Defined in:
- lib/rubocop/cop/ignored_node.rb
Overview
Handles adding and checking ignored nodes.
Instance Method Summary collapse
Instance Method Details
#ignore_node(node) ⇒ Object
7 8 9 |
# File 'lib/rubocop/cop/ignored_node.rb', line 7 def ignore_node(node) ignored_nodes << node end |
#ignored_node?(node) ⇒ Boolean
19 20 21 22 |
# File 'lib/rubocop/cop/ignored_node.rb', line 19 def ignored_node?(node) # Same object found in array? ignored_nodes.any? { |n| n.equal?(node) } end |
#part_of_ignored_node?(node) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/rubocop/cop/ignored_node.rb', line 11 def part_of_ignored_node?(node) expression = node.loc.expression ignored_nodes.any? do |ignored_node| ignored_node.loc.expression.begin_pos <= expression.begin_pos && ignored_node.loc.expression.end_pos >= expression.end_pos end end |