Created
February 26, 2010 15:55
-
-
Save myabc/315835 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b50ff2f453ec40b7e701ec55b08ee5dddffd8c89 Mon Sep 17 00:00:00 2001 | |
From: Alex Coles <[email protected]> | |
Date: Fri, 26 Feb 2010 16:53:21 +0100 | |
Subject: [PATCH] Rename metaclass to singleton_class | |
* Reflects rename in commit f863045 in rails/rails (made with no | |
explanation in commit message, but presumably for good reason). | |
Signed-off-by: Alex Coles <[email protected]> | |
--- | |
lib/dm-core/model.rb | 2 +- | |
lib/dm-core/support/extlib.rb | 2 +- | |
lib/dm-core/support/hook.rb | 2 +- | |
spec/public/shared/sel_shared_spec.rb | 4 ++-- | |
.../semipublic/query/conditions/comparison_spec.rb | 4 ++-- | |
spec/semipublic/query/conditions/operation_spec.rb | 4 ++-- | |
6 files changed, 9 insertions(+), 9 deletions(-) | |
diff --git a/lib/dm-core/model.rb b/lib/dm-core/model.rb | |
index a2ffd6b..b9a0b18 100644 | |
--- a/lib/dm-core/model.rb | |
+++ b/lib/dm-core/model.rb | |
@@ -715,7 +715,7 @@ module DataMapper | |
# @api private | |
def model_methods | |
- @model_methods ||= ancestor_instance_methods { |mod| mod.metaclass } | |
+ @model_methods ||= ancestor_instance_methods { |mod| mod.singleton_class } | |
end | |
# @api private | |
diff --git a/lib/dm-core/support/extlib.rb b/lib/dm-core/support/extlib.rb | |
index ea5191a..19fc043 100644 | |
--- a/lib/dm-core/support/extlib.rb | |
+++ b/lib/dm-core/support/extlib.rb | |
@@ -19,7 +19,7 @@ module DataMapper | |
end | |
class Object | |
- alias metaclass meta_class | |
+ alias singleton_class meta_class | |
end | |
module ActiveSupport | |
diff --git a/lib/dm-core/support/hook.rb b/lib/dm-core/support/hook.rb | |
index 128dfba..78ea70b 100644 | |
--- a/lib/dm-core/support/hook.rb | |
+++ b/lib/dm-core/support/hook.rb | |
@@ -361,7 +361,7 @@ module DataMapper | |
if block | |
method_sym = "__hooks_#{type}_#{quote_method(target_method)}_#{hooks[target_method][type].length}".to_sym | |
if scope == :class | |
- metaclass.instance_eval do | |
+ singleton_class.instance_eval do | |
define_method(method_sym, &block) | |
end | |
else | |
diff --git a/spec/public/shared/sel_shared_spec.rb b/spec/public/shared/sel_shared_spec.rb | |
index eabeff9..f470fd2 100644 | |
--- a/spec/public/shared/sel_shared_spec.rb | |
+++ b/spec/public/shared/sel_shared_spec.rb | |
@@ -20,7 +20,7 @@ share_examples_for 'A Collection supporting Strategic Eager Loading' do | |
before :all do | |
@original_adapter = @adapter | |
- @adapter.metaclass.class_eval do | |
+ @adapter.singleton_class.class_eval do | |
def eql?(other) | |
super || self == other | |
end | |
@@ -75,7 +75,7 @@ share_examples_for 'A Resource supporting Strategic Eager Loading' do | |
before :all do | |
@original_adapter = @adapter | |
- @adapter.metaclass.class_eval do | |
+ @adapter.singleton_class.class_eval do | |
def eql?(other) | |
super || other == self | |
end | |
diff --git a/spec/semipublic/query/conditions/comparison_spec.rb b/spec/semipublic/query/conditions/comparison_spec.rb | |
index 8f45159..742a71c 100644 | |
--- a/spec/semipublic/query/conditions/comparison_spec.rb | |
+++ b/spec/semipublic/query/conditions/comparison_spec.rb | |
@@ -64,7 +64,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do | |
describe 'when the other AbstractComparison is equal' do | |
# artifically modify the object so #== will throw an | |
# exception if the equal? branch is not followed when heckling | |
- before { @comparison.metaclass.send(:undef_method, :slug) } | |
+ before { @comparison.singleton_class.send(:undef_method, :slug) } | |
subject { @comparison == @comparison } | |
@@ -102,7 +102,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do | |
describe 'when the other AbstractComparison is equal' do | |
# artifically modify the object so #eql? will throw an | |
# exception if the equal? branch is not followed when heckling | |
- before { @comparison.metaclass.send(:undef_method, :slug) } | |
+ before { @comparison.singleton_class.send(:undef_method, :slug) } | |
subject { @comparison.eql?(@comparison) } | |
diff --git a/spec/semipublic/query/conditions/operation_spec.rb b/spec/semipublic/query/conditions/operation_spec.rb | |
index e7bc1d2..ae2a9c3 100644 | |
--- a/spec/semipublic/query/conditions/operation_spec.rb | |
+++ b/spec/semipublic/query/conditions/operation_spec.rb | |
@@ -107,7 +107,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do | |
describe 'when the other AbstractOperation is equal' do | |
# artifically modify the object so #eql? will throw an | |
# exception if the equal? branch is not followed when heckling | |
- before { @operation.metaclass.send(:undef_method, :slug) } | |
+ before { @operation.singleton_class.send(:undef_method, :slug) } | |
subject { @operation == @operation } | |
@@ -247,7 +247,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do | |
describe 'when the other AbstractOperation is equal' do | |
# artifically modify the object so #eql? will throw an | |
# exception if the equal? branch is not followed when heckling | |
- before { @operation.metaclass.send(:undef_method, :slug) } | |
+ before { @operation.singleton_class.send(:undef_method, :slug) } | |
subject { @operation.eql?(@operation) } | |
-- | |
1.7.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment