summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2014-10-21 10:05:05 -0400
committerAustin Ziegler <austin@zieglers.ca>2014-10-21 10:05:05 -0400
commitfbdde28897b51c9de928fcc82b96709a74f848d8 (patch)
treee3b0dd448c11c4c977c37b2b139609fb593a8ddf
parentec1b8c7f6d364ed08e8eec2d76e8c6c0f7a0ca76 (diff)
downloadmime-types-fbdde28897b51c9de928fcc82b96709a74f848d8.tar.gz
Restore Ruby 1.9.2 support.v2.4.3
- Fixes #77.
-rw-r--r--History.rdoc9
-rw-r--r--README.rdoc11
-rw-r--r--lib/mime/type.rb11
-rw-r--r--lib/mime/types/loader.rb3
4 files changed, 23 insertions, 11 deletions
diff --git a/History.rdoc b/History.rdoc
index d2b374f..f0b1884 100644
--- a/History.rdoc
+++ b/History.rdoc
@@ -1,3 +1,12 @@
+== 2.4.3 / 2014-10-21
+
+* Bugs:
+ * Restored Ruby 1.9.2 support by using +private_constant+ conditionally.
+ Fixes {#77}[https://github.com/halostatue/mime-types/issues/77] found by
+ Kris Leech (@krisleech). The conditional use of +private_constant+ here
+ will be removed for mime-types 3.0, when Ruby 1.9.2 support will be
+ unconditionally removed.
+
== 2.4.2 / 2014-10-15
* Bugs:
diff --git a/README.rdoc b/README.rdoc
index 125b039..16a664f 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -24,12 +24,11 @@ add additional type definitions (see Contributing.rdoc). The primary sources
for MIME type definitions found in mime-types is the IANA collection of
registrations (see below for the link), RFCs, and W3C recommendations.
-This is release 2.4.2, fixing bugs with unnecessary object duplication and
-using JSON.parse instead of JSON.load. These fixes improve the JSON registry
-loading time by about 55% over previous 2.x releases. Cached registry load
-times are not changed. This release builds on the 2.4.1 release, which fixed a
-bug in observed use of the mime-types library where extensions were not
-previously sorted, such that
+This is release 2.4.3, restoring full compatibility with Ruby 1.9.2 (which will
+be dropped in mime-types 3.0). It also includes the performance improvements
+from mime-types 2.4.2 (since yanked because of the broken Ruby 1.9.2 support)
+and the 2.4.1 fix of a bug in observed use of the mime-types library where
+extensions were not previously sorted, such that
MIME::Types.of('image.jpg').first.extensions.first
diff --git a/lib/mime/type.rb b/lib/mime/type.rb
index b78084d..d998fa3 100644
--- a/lib/mime/type.rb
+++ b/lib/mime/type.rb
@@ -56,7 +56,7 @@ class MIME::Type
end
# The released version of the mime-types library.
- VERSION = '2.4.2'
+ VERSION = '2.4.3'
include Comparable
@@ -74,9 +74,12 @@ class MIME::Type
RFC_URL = "http://rfc-editor.org/rfc/rfc%s.txt"
DRAFT_URL = "http://datatracker.ietf.org/public/idindex.cgi?command=id_details&filename=%s"
CONTACT_URL = "http://www.iana.org/assignments/contact-people.htm#%s"
- private_constant :MEDIA_TYPE_RE, :UNREGISTERED_RE, :I18N_RE, :PLATFORM_RE,
- :DEFAULT_ENCODINGS, :BINARY_ENCODINGS, :TEXT_ENCODINGS, :VALID_ENCODINGS,
- :IANA_URL, :RFC_URL, :DRAFT_URL, :CONTACT_URL
+
+ if respond_to? :private_constant
+ private_constant :MEDIA_TYPE_RE, :UNREGISTERED_RE, :I18N_RE, :PLATFORM_RE,
+ :DEFAULT_ENCODINGS, :BINARY_ENCODINGS, :TEXT_ENCODINGS, :VALID_ENCODINGS,
+ :IANA_URL, :RFC_URL, :DRAFT_URL, :CONTACT_URL
+ end
# Builds a MIME::Type object from the provided MIME Content Type value
# (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object is
diff --git a/lib/mime/types/loader.rb b/lib/mime/types/loader.rb
index 1d91a96..4fd427d 100644
--- a/lib/mime/types/loader.rb
+++ b/lib/mime/types/loader.rb
@@ -235,5 +235,6 @@ class MIME::Types::Loader
\s*
\z
}x
- private_constant :V1_FORMAT
+
+ private_constant :V1_FORMAT if respond_to? :private_constant
end