lib/renum.rb in renum-0.0.1 vs lib/renum.rb in renum-0.0.3

- old
+ new

@@ -1,15 +1,14 @@ $:.unshift File.dirname(__FILE__) -require 'renum/enumerated_value' +require 'renum/enumerated_value_type_factory' module Renum def enum type_name, values, &block - klass = Class.new EnumeratedValue - Object.const_set(type_name, klass) - klass.class_eval &block if block_given? - values.each do |name| - klass.const_set(name, klass.new(name)) - end + nest = self.is_a?(Module) ? self : Object + EnumeratedValueTypeFactory.create(nest, type_name, values, &block) end end extend Renum +Module.module_eval do + include Renum +end \ No newline at end of file