Permalink
Browse files

Forgot the type id factory used a Worker class. Fixed the wrong class…

… name in the exception.
  • Loading branch information...
1 parent b3bb2ef commit 14516e75f3d49ff6cbdda3575648f07cc6d4f2c0 @sneakin committed Oct 23, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/mc/type_id_factory.rb
@@ -4,7 +4,7 @@ module MC
module TypeIdFactory
def self.included(base)
base.instance_eval <<-EOT
- Factory = TypeIdFactory::Worker.new
+ Factory = TypeIdFactory::Worker.new(self)
def types
Factory.types
@@ -21,8 +21,12 @@ def create(id)
end
class Worker
+ def initialize(klass)
+ @klass = klass
+ end
+
def types
- @types ||= Hash.new { |h, key| raise "Bad type id, %#x, for class #{self.class}" % [ key ] }
+ @types ||= Hash.new { |h, key| raise "Bad type id, %#x, for class #{@klass}" % [ key ] }
end
def register(id, klass)

0 comments on commit 14516e7

Please sign in to comment.