Module: RuboCop::Cop::MigrationsHelper

Extended by:
NodePattern::Macros
Included in:
Rails::MigrationClassName, Rails::ReversibleMigration, Rails::ReversibleMigrationMethodDefinition
Defined in:
lib/rubocop/cop/mixin/migrations_helper.rb

Overview

Common functionality for cops working with migrations

Instance Method Summary collapse

Instance Method Details

#in_migration?(node) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/rubocop/cop/mixin/migrations_helper.rb', line 19

def in_migration?(node)
  node.each_ancestor(:class).any? do |class_node|
    migration_class?(class_node)
  end
end