Skip to content

Commit ad98f13

Browse files
committed
use PRISM_PARSER in rails/use_migration_instance_methods
1 parent b6df575 commit ad98f13

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/rails/use_migrations_instance_methods.rb

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
Synvert::Rewriter.new 'rails', 'use_migrations_instance_methods' do
4-
configure(parser: Synvert::PARSER_PARSER)
4+
configure(parser: Synvert::PRISM_PARSER)
55

66
description <<~EOS
77
It uses instance methods rather than class methods in migrations.
@@ -30,10 +30,8 @@ def down
3030
within_files Synvert::RAILS_MIGRATION_FILES do
3131
# def self.up => def up
3232
# def self.down => def down
33-
%w[up down].each do |name|
34-
with_node node_type: 'defs', name: name do
35-
delete :self, :dot
36-
end
33+
with_node node_type: 'def_node', name: { in: ['up', 'down'] }, receiver: { node_type: 'self_node' } do
34+
delete :receiver, :operator
3735
end
3836
end
3937
end

0 commit comments

Comments
 (0)