Merge pull request #38 from wycats/module_cleanup

Clean up module usage.
This commit is contained in:
Zach Dennis 2012-01-03 06:20:48 -08:00
commit 2539a71574
7 changed files with 61 additions and 75 deletions

View file

@ -2,5 +2,5 @@ require "active_record/connection_adapters/mysql2_adapter"
require "activerecord-import/adapters/mysql_adapter"
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
include ActiveRecord::Import::MysqlAdapter::InstanceMethods
include ActiveRecord::Import::MysqlAdapter
end

View file

@ -2,5 +2,5 @@ require "active_record/connection_adapters/mysql_adapter"
require "activerecord-import/adapters/mysql_adapter"
class ActiveRecord::ConnectionAdapters::MysqlAdapter
include ActiveRecord::Import::MysqlAdapter::InstanceMethods
include ActiveRecord::Import::MysqlAdapter
end

View file

@ -2,6 +2,6 @@ require "active_record/connection_adapters/postgresql_adapter"
require "activerecord-import/adapters/postgresql_adapter"
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
include ActiveRecord::Import::PostgreSQLAdapter::InstanceMethods
include ActiveRecord::Import::PostgreSQLAdapter
end

View file

@ -2,6 +2,6 @@ require "active_record/connection_adapters/sqlite3_adapter"
require "activerecord-import/adapters/sqlite3_adapter"
class ActiveRecord::ConnectionAdapters::Sqlite3Adapter
include ActiveRecord::Import::Sqlite3Adapter::InstanceMethods
include ActiveRecord::Import::Sqlite3Adapter
end

View file

@ -1,11 +1,6 @@
module ActiveRecord::Import::MysqlAdapter
module InstanceMethods
def self.included(klass)
klass.instance_eval do
include ActiveRecord::Import::ImportSupport
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
end
end
# Returns the maximum number of bytes that the server will allow
# in a single packet
@ -56,4 +51,3 @@ module ActiveRecord::Import::MysqlAdapter
exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')
end
end
end

View file

@ -1,13 +1,7 @@
module ActiveRecord::Import::PostgreSQLAdapter
module InstanceMethods
def self.included(klass)
klass.instance_eval do
include ActiveRecord::Import::ImportSupport
end
end
def next_value_for_sequence(sequence_name)
%{nextval('#{sequence_name}')}
end
end
end

View file

@ -1,7 +1,5 @@
module ActiveRecord::Import::Sqlite3Adapter
module InstanceMethods
def next_value_for_sequence(sequence_name)
%{nextval('#{sequence_name}')}
end
end
end