Class: RuboCop::Kata::Variable::Inlining

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/kata/variable/inlining.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

PRIMARY =
%i[
  int float str sym dstr dsym xstr true false nil array hash regexp
  lvar ivar cvar gvar const self nth_ref back_ref
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(rhs, read) ⇒ Inlining

Returns a new instance of Inlining.



13
14
15
16
# File 'lib/rubocop/kata/variable/inlining.rb', line 13

def initialize(rhs, read)
  @rhs = rhs
  @read = read
end

Instance Method Details

#rangeObject



18
# File 'lib/rubocop/kata/variable/inlining.rb', line 18

def range = pair.nil? ? @read.source_range : pair.source_range

#textObject



20
# File 'lib/rubocop/kata/variable/inlining.rb', line 20

def text = pair.nil? ? value : "#{pair.children.first.source}: #{value}"