Class: RuboCop::Cop::Sorbet::EnforceSignatures::SigSuggestion

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(indent, param_placeholder, return_placeholder) ⇒ SigSuggestion

Returns a new instance of SigSuggestion.



253
254
255
256
257
258
259
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 253

def initialize(indent, param_placeholder, return_placeholder)
  @params = []
  @returns = nil
  @indent = indent
  @param_placeholder = param_placeholder
  @return_placeholder = return_placeholder
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



251
252
253
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 251

def params
  @params
end

#returnsObject

Returns the value of attribute returns.



251
252
253
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 251

def returns
  @returns
end

Instance Method Details

#to_autocorrectObject



261
262
263
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 261

def to_autocorrect
  "sig { #{generate_params}#{generate_return} }\n#{" " * @indent}"
end