lib/classy_enum.rb in classy_enum-0.1.0 vs lib/classy_enum.rb in classy_enum-0.2.0
- old
+ new
@@ -51,12 +51,14 @@
other.extend ClassMethods
other.const_set("OPTION_HASH", Hash.new)
other::OPTIONS.each do |option|
- klass = Class.new(ClassyEnumValue) {
- include other::Defaults if other.const_defined?("Defaults")
- }
+
+ klass = Class.new(ClassyEnumValue) do
+ include other::InstanceMethods if other.const_defined?("InstanceMethods")
+ extend other::ClassMethods if other.const_defined?("ClassMethods")
+ end
Object.const_set("#{other}#{option.to_s.camelize}", klass)
instance = klass.new(option, other::OPTIONS.index(option))