lib/miu/messages.rb in miu-0.1.0 vs lib/miu/messages.rb in miu-0.2.0
- old
+ new
@@ -1,6 +1,21 @@
module Miu
module Messages
- autoload :Base, 'miu/messages/base'
- autoload :Text, 'miu/messages/text'
+ class << self
+ def types
+ @types ||= {}
+ end
+
+ def register(type, klass)
+ types[type.to_s] = klass
+ end
+
+ def guess(type)
+ types[type.to_s] || Unknown
+ end
+ end
end
end
+
+require 'miu/messages/base'
+require 'miu/messages/unknown'
+require 'miu/messages/text'