From b9382fe8c1593c7d6589cd62d59903926cfca51b Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 16 Feb 2023 21:45:29 -0500 Subject: Various upgrades - Update the .github/workflows/ci.yml workflow to test Ruby 3.2 and more reliably test certain combinations rather than depending on exclusions. - Change `.standard.yml` configuration to format for Ruby 2.3 as certain files are not properly detected with Ruby 2.0. - Change from `hoe-git` to `hoe-git2` to support Hoe version 4. - Apply `standardrb --fix`. - Update other dependencies. --- lib/mime/type.rb | 2 +- lib/mime/types.rb | 12 ++++++------ lib/mime/types/cache.rb | 6 +----- lib/mime/types/deprecations.rb | 22 +++++++++++----------- 4 files changed, 19 insertions(+), 23 deletions(-) (limited to 'lib') diff --git a/lib/mime/type.rb b/lib/mime/type.rb index d40b9b1..f0ec15e 100644 --- a/lib/mime/type.rb +++ b/lib/mime/type.rb @@ -364,7 +364,7 @@ class MIME::Type # Returns the default encoding for the MIME::Type based on the media type. def default_encoding - @media_type == "text" ? "quoted-printable" : "base64" + (@media_type == "text") ? "quoted-printable" : "base64" end ## diff --git a/lib/mime/types.rb b/lib/mime/types.rb index 31692ca..e9db72b 100644 --- a/lib/mime/types.rb +++ b/lib/mime/types.rb @@ -125,12 +125,12 @@ class MIME::Types def [](type_id, complete: false, registered: false) matches = case type_id - when MIME::Type - @type_variants[type_id.simplified] - when Regexp - match(type_id) - else - @type_variants[MIME::Type.simplified(type_id)] + when MIME::Type + @type_variants[type_id.simplified] + when Regexp + match(type_id) + else + @type_variants[MIME::Type.simplified(type_id)] end prune_matches(matches, complete, registered).sort { |a, b| diff --git a/lib/mime/types/cache.rb b/lib/mime/types/cache.rb index 71d488e..2e70775 100644 --- a/lib/mime/types/cache.rb +++ b/lib/mime/types/cache.rb @@ -49,10 +49,6 @@ class << MIME::Types::Cache types ||= MIME::Types.send(:__types__) - File.open(cache_file, "wb") do |f| - f.write( - Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types))) - ) - end + File.binwrite(cache_file, Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types)))) end end diff --git a/lib/mime/types/deprecations.rb b/lib/mime/types/deprecations.rb index 3c64977..cf9c297 100644 --- a/lib/mime/types/deprecations.rb +++ b/lib/mime/types/deprecations.rb @@ -10,20 +10,20 @@ module MIME def self.deprecated(klass, sym, message = nil, &block) # :nodoc: level = case klass - when Class, Module - "." - else - klass = klass.class - "#" + when Class, Module + "." + else + klass = klass.class + "#" end message = case message - when :private, :protected - "and will be #{message}" - when nil - "and will be removed" - else - message + when :private, :protected + "and will be #{message}" + when nil + "and will be removed" + else + message end MIME::Types.logger.warn <<-WARNING.chomp.strip #{caller(2..2).first}: #{klass}#{level}#{sym} is deprecated #{message}. -- cgit v1.2.1