Class: RuboCop::Kata::Variable::Gap
- Inherits:
-
Object
- Object
- RuboCop::Kata::Variable::Gap
- Defined in:
- lib/rubocop/kata/variable/gap.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
- PURE =
%i[ int float rational complex str sym true false nil array hash regexp regopt irange erange lvar self pair begin ].freeze
Instance Method Summary collapse
- #crossed?(assign, read) ⇒ Boolean
-
#initialize(movable) ⇒ Gap
constructor
A new instance of Gap.
Constructor Details
#initialize(movable) ⇒ Gap
Returns a new instance of Gap.
13 14 15 16 |
# File 'lib/rubocop/kata/variable/gap.rb', line 13 def initialize(movable) @movable = movable @memo = {} end |
Instance Method Details
#crossed?(assign, read) ⇒ Boolean
18 19 20 21 |
# File 'lib/rubocop/kata/variable/gap.rb', line 18 def crossed?(assign, read) @memo[assign] = scan?(assign, read) unless @memo.key?(assign) @memo[assign] end |