Class: RuboCop::Cop::FactoryBot::CreateList::CreateListCorrector
- Inherits:
-
Object
- Object
- RuboCop::Cop::FactoryBot::CreateList::CreateListCorrector
- Includes:
- Corrector
- Defined in:
- lib/rubocop/cop/factory_bot/create_list.rb
Overview
:nodoc:
Instance Method Summary collapse
- #call(corrector) ⇒ Object
-
#initialize(node) ⇒ CreateListCorrector
constructor
A new instance of CreateListCorrector.
Constructor Details
#initialize(node) ⇒ CreateListCorrector
Returns a new instance of CreateListCorrector.
257 258 259 |
# File 'lib/rubocop/cop/factory_bot/create_list.rb', line 257 def initialize(node) @node = node.parent end |
Instance Method Details
#call(corrector) ⇒ Object
261 262 263 264 265 266 267 268 269 |
# File 'lib/rubocop/cop/factory_bot/create_list.rb', line 261 def call(corrector) replacement = if node.body.block_type? call_with_block_replacement(node) else call_replacement(node) end corrector.replace(node, replacement) end |