diff --git a/lib/mime/types.rb b/lib/mime/types.rb index f1caf3c..de2afec 100644 --- a/lib/mime/types.rb +++ b/lib/mime/types.rb @@ -597,12 +597,13 @@ def defined_types #:nodoc: @type_variants.values.flatten end + # Returns the number of known types. A shortcut of MIME::Types[//].size def count - @type_variants.size + defined_types.size end def each - @type_variants.each { |t| yield t } + defined_types.each { |t| yield t } end @__types__ = self.new(VERSION) diff --git a/test/test_mime_types.rb b/test/test_mime_types.rb index 0e47638..f8bfd2f 100644 --- a/test/test_mime_types.rb +++ b/test/test_mime_types.rb @@ -72,7 +72,7 @@ def test_class_of end def test_class_enumerable - assert( MIME::Types.any? {|types| types[0] == 'text/plain'} ) + assert( MIME::Types.any? {|type| type.content_type == 'text/plain'} ) end def test_class_count