Class: RuboCop::Kata::Variable::Boundary
- Inherits:
-
Object
- Object
- RuboCop::Kata::Variable::Boundary
- Defined in:
- lib/rubocop/kata/variable/boundary.rb
Overview
SPDX-FileCopyrightText: Copyright (c) 2019-2026 Yegor Bugayenko SPDX-License-Identifier: MIT Derived from rubocop-elegant (https://github.com/yegor256/rubocop-elegant), see LICENSE.txt
Constant Summary collapse
- LOOPS =
%i[block numblock while until while_post until_post for].freeze
- FIRSTS =
%i[if case case_match and or].freeze
- HOISTS =
%i[rescue resbody ensure].freeze
Instance Method Summary collapse
- #crossed? ⇒ Boolean
-
#initialize(assign, read) ⇒ Boundary
constructor
A new instance of Boundary.
Constructor Details
#initialize(assign, read) ⇒ Boundary
Returns a new instance of Boundary.
12 13 14 15 |
# File 'lib/rubocop/kata/variable/boundary.rb', line 12 def initialize(assign, read) @assign = assign @read = read end |
Instance Method Details
#crossed? ⇒ Boolean
17 18 19 20 |
# File 'lib/rubocop/kata/variable/boundary.rb', line 17 def crossed? return true unless @read.each_ancestor.any? { it.equal?(@assign.parent) } steps.any? { |child, parent| blocks?(child, parent) } end |