Permalink
Browse files

Don't define public class methods in class << self blocks

  • Loading branch information...
1 parent c28fd60 commit 4bb2f98acd447f64d65c312af1276cced58570d3 @dkubb dkubb committed May 24, 2010
Showing with 15 additions and 17 deletions.
  1. +15 −17 lib/dm-migrations/auto_migration.rb
View
32 lib/dm-migrations/auto_migration.rb
@@ -182,8 +182,9 @@ def auto_migrate_up!(repository_name = self.repository_name)
def self.include_migration_api
DataMapper.extend(Migrations::SingletonMethods)
- DataMapper::Model.send(:include, Migrations::Model)
- DataMapper::Repository.send(:include, Migrations::Repository)
+ [ :Repository, :Model ].each do |name|
+ DataMapper.const_get(name).send(:include, Migrations.const_get(name))
+ end
DataMapper::Model.append_extensions(Migrations::Model)
DataMapper::Adapters::AbstractAdapter.descendants.each do |adapter_class|
Adapters.include_migration_api(ActiveSupport::Inflector.demodulize(adapter_class.name))
@@ -194,25 +195,22 @@ def self.include_migration_api
module Adapters
- extend Chainable
-
- class << self
-
- def include_migration_api(const_name)
- require auto_migration_extensions(const_name)
+ def self.include_migration_api(const_name)
+ require auto_migration_extensions(const_name)
+ if DataMapper::Migrations.const_defined?(const_name)
adapter = const_get(const_name)
- if DataMapper::Migrations.const_defined?(const_name)
- adapter.send(:include, migration_module(const_name))
- end
- rescue LoadError
- # Silently ignore the fact that no adapter extensions could be required
- # This means that the adapter in use doesn't support migrations
+ adapter.send(:include, migration_module(const_name))
end
+ rescue LoadError
+ # Silently ignore the fact that no adapter extensions could be required
+ # This means that the adapter in use doesn't support migrations
+ end
- def migration_module(const_name)
- DataMapper::Migrations.const_get(const_name)
- end
+ def self.migration_module(const_name)
+ DataMapper::Migrations.const_get(const_name)
+ end
+ class << self
private
# @api private

0 comments on commit 4bb2f98

Please sign in to comment.