Class: RuboCop::Cop::Migration::RemoveColumn::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/migration/remove_column.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, parser_engine:, path:, target_ruby_version:) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • content (String)
  • parser_engine (Symbol)
  • path (String)
  • target_ruby_version (#to_s)


211
212
213
214
215
216
217
218
219
220
221
# File 'lib/rubocop/cop/migration/remove_column.rb', line 211

def initialize(
  content:,
  parser_engine:,
  path:,
  target_ruby_version:
)
  @content = content
  @parser_engine = parser_engine
  @path = path
  @target_ruby_version = target_ruby_version
end

Class Method Details

.call(content:, parser_engine:, path:, target_ruby_version:) ⇒ RuboCop::AST::Node

Parameters:

  • content (String)
  • parser_engine (Symbol)
  • path (String)
  • target_ruby_version (#to_s)

Returns:

  • (RuboCop::AST::Node)


192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/rubocop/cop/migration/remove_column.rb', line 192

def call(
  content:,
  parser_engine:,
  path:,
  target_ruby_version:
)
  new(
    content: content,
    parser_engine: parser_engine,
    path: path,
    target_ruby_version: target_ruby_version
  ).call
end

Instance Method Details

#callRuboCop::AST::Node

Returns:

  • (RuboCop::AST::Node)


224
225
226
227
228
229
230
231
# File 'lib/rubocop/cop/migration/remove_column.rb', line 224

def call
  ::RuboCop::ProcessedSource.new(
    @content,
    @target_ruby_version,
    @path,
    parser_engine: @parser_engine
  ).ast
end