Module: RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour

Defined in:
lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



10
11
12
13
14
15
# File 'lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb', line 10

def prepended(base)
  # @!method t_let(node)
  base.def_node_matcher(:t_let, <<~PATTERN)
    (send (const nil? :T) :let $_constant _type)
  PATTERN
end

Instance Method Details

#on_assignment(value) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb', line 18

def on_assignment(value)
  t_let(value) do |constant|
    value = constant
  end

  super(value)
end