Browse files

Rename ClassExtensions to ClassInclusions

* Change so that ClassInclusions is included, since it mostly just extends the
  descendant and adds instance methods.
  • Loading branch information...
1 parent 8f3c2a6 commit 6f6e96e8e6e71578ffd84246a922f5a9b5603d40 @dkubb dkubb committed Jun 4, 2012
Showing with 23 additions and 26 deletions.
  1. +2 −2 lib/virtus.rb
  2. +0 −23 lib/virtus/class_extensions.rb
  3. +20 −0 lib/virtus/class_inclusions.rb
  4. +1 −1 lib/virtus/module_extensions.rb
View
4 lib/virtus.rb
@@ -26,7 +26,7 @@ module Virtus
def self.included(object)
super
case object
- when Class then object.extend(ClassExtensions)
+ when Class then object.send(:include, ClassInclusions)
when Module then object.extend(ModuleExtensions)
end
end
@@ -46,7 +46,7 @@ def self.extended(object)
require 'virtus/support/equalizer'
require 'virtus/instance_extensions'
-require 'virtus/class_extensions'
+require 'virtus/class_inclusions'
require 'virtus/module_extensions'
require 'virtus/attributes_accessor'
View
23 lib/virtus/class_extensions.rb
@@ -1,23 +0,0 @@
-module Virtus
- module ClassExtensions
-
- def self.extended(descendant)
- super
- descendant.extend(ClassMethods)
- descendant.extend(InstanceExtensions::AllowedWriterMethods)
- descendant.send(:include, Virtus::InstanceMethods)
- descendant.send(:include, InstanceMethods)
- end
-
- module InstanceMethods
- def _attributes
- self.class.attributes
- end
-
- def allowed_writer_methods
- self.class.allowed_writer_methods
- end
- end
-
- end # module Class
-end # module Virtus
View
20 lib/virtus/class_inclusions.rb
@@ -0,0 +1,20 @@
+module Virtus
+ module ClassInclusions
+
+ def self.included(descendant)
+ super
+ descendant.extend(ClassMethods)
+ descendant.extend(InstanceExtensions::AllowedWriterMethods)
+ descendant.send(:include, InstanceMethods)
+ end
+
+ def _attributes
+ self.class.attributes
+ end
+
+ def allowed_writer_methods
+ self.class.allowed_writer_methods
+ end
+
+ end # module ClassInclusions
+end # module Virtus
View
2 lib/virtus/module_extensions.rb
@@ -10,7 +10,7 @@ def extended(object)
end
def included(object)
- object.extend(ClassExtensions)
+ object.send(:include, ClassInclusions)
define_attributes(object)
end

0 comments on commit 6f6e96e

Please sign in to comment.