-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mime-types should not forcibly require json #85
Comments
It is correct that the mime-types gem does not depend on any JSON gem because The What I can probably do is remove the |
@halostatue ah ha, I believe it's because bundler is excluding json for some reason. There's another option which would be the much efficient, but not as elegant. Instead of generating a JSON document, generate a Ruby file that defines a giant literal Array of content types. |
That’s certainly a possibility, and worth considering for 3.0—it may help with the memory use and provide somewhat smarter/lighter data loading (I’d love to be able to get lazy loading really granular, because it would do more to help #83 than anything else). I’m still going to be generating the JSON in some form of 3.0 because I’ve ported the core functionality to Io and want to do the same for a few other languages (as a learning exercise), plus someone ported mime-types (v1) to Python a few years ago, and they recently got a issue requesting a bump to the v2 data, so I think that the software-readable data that I’m providing is of value, and JSON is a fairly clean (and mostly safe) way to do that in a way that YAML implementations are less likely to provide. |
I will certainly benchmark the startup time of an array vs. the JSON. I suspect that it will be faster than JSON, and if that’s the case, it’s worth pursuing all on its own. |
The default registry store for mime-types 3.0 is the columnar store, required with I’m not pursuing the idea of a generated array because of previously noted memory usage issues. |
- Require Ruby 2.0 or later. Resolves #97. - Remove deprecated methods. - Update known registries when a MIME type extension changes. Resolves #84. - Relicensed mime-types 3.0 as MIT only. Resolves #95. - Extracted data from this gem to mime-types-data; removed deprecated data. - Rewrote tests to better understand what is being tested—some of the tests were almost ten years old and didn’t make a lot of sense with this version. I have switched to minitest/spec with assertions. - Columnar data is now the default registry store. Because JSON is not required by default, this change resolves #85. - MIME::Types containers are now implemented with Set instead of Array to prevent data duplication. Resolves #79.
- Require Ruby 2.0 or later. Resolves #97. - Remove deprecated methods. - Update known registries when a MIME type extension changes. Resolves #84. - Relicensed mime-types 3.0 as MIT only. Resolves #95. - Extracted data from this gem to mime-types-data; removed deprecated data. - Rewrote tests to better understand what is being tested—some of the tests were almost ten years old and didn’t make a lot of sense with this version. I have switched to minitest/spec with assertions. - Columnar data is now the default registry store. Because JSON is not required by default, this change resolves #85. - MIME::Types containers are now implemented with Set instead of Array to prevent data duplication. Resolves #79.
mime/type.rb
requires 'json' but the mime-types gem does not dependent on any json gem.mime/types.rb
seems to only require json for theto_json
method. This could be moved into a separate file, or maybe only define#to_json
ifdefined?(JSON)
.mime/types/loader.rb
uses JSON to loaddata/mime-types.json
, but perhaps this could be converted to YAML to avoid the json dependency?The text was updated successfully, but these errors were encountered: