shrine-thumbhash 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b41c1fac9cd933c44eb7f8867dcf0d6d5f66853ad22ec975b7a127866d2dab57
4
- data.tar.gz: 0a5251f90a8d0697afd701151a5af94e994b0b073d98cd897a22df5714608b87
3
+ metadata.gz: ee8aaf148c08e609fb95032fca0a7e0157de3c6c858bdce559819468422c3668
4
+ data.tar.gz: 389d08019c08d1f7342ab1697a99d8e7470f7ef0e2c123357a82799be6589969
5
5
  SHA512:
6
- metadata.gz: 2307fbd23a1cff609eadfc9d99a20e126f3fe3fa37d2b5914b2a98f95b50cb4eb07d1584ba7ae1c3bbaec1c422d76a130c2b5b216e861a160e1f52a64a515c1f
7
- data.tar.gz: 93722745374a9f0cf9674cc9e4fff90b78655d88a021148bbaffe4e86c9f3251435cf70d7e51f5cf587ec7fbda5c1898fef80cbeb126ebf7ff3210299ce8aaf0
6
+ metadata.gz: 15a935af3b347713b2cc5005fc2eee91dfc359f6d43f86666090405f7a537facc2b4f91475de633547d70517b59bb1994364789577967889e2160bb7c6584a51
7
+ data.tar.gz: 3003658026f984a4d96bec4537101ff28b002e6cb77a766d66bb66ff9c3495a103c1322330be7f348458783d2bda7493de71fa24063bffda2657b17fb937823c
data/.rubocop.yml CHANGED
@@ -16,3 +16,7 @@ Style/StringLiterals:
16
16
  Style/StringLiteralsInInterpolation:
17
17
  Enabled: true
18
18
  EnforcedStyle: double_quotes
19
+
20
+ Style/SymbolArray:
21
+ Enabled: true
22
+ EnforcedStyle: brackets
data/Rakefile CHANGED
@@ -9,4 +9,4 @@ require "rubocop/rake_task"
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
12
- task default: %i[spec rubocop]
12
+ task default: [:spec, :rubocop]
@@ -3,7 +3,7 @@
3
3
  class Shrine
4
4
  module Plugins
5
5
  module Thumbhash
6
- VERSION = "0.2.0"
6
+ VERSION = "0.2.1"
7
7
  end
8
8
  end
9
9
  end
@@ -6,6 +6,10 @@ require "thumbhash"
6
6
  class Shrine # :nodoc:
7
7
  module Plugins # :nodoc:
8
8
  module Thumbhash # :nodoc:
9
+ IMAGE_LOADER_CHOICES = [
10
+ :ruby_vips,
11
+ :mini_magick
12
+ ].freeze
9
13
  DEFAULT_OPTIONS = {
10
14
  padding: true,
11
15
  image_loader: :ruby_vips
@@ -14,7 +18,11 @@ class Shrine # :nodoc:
14
18
  def self.configure(uploader, **opts)
15
19
  uploader.opts[:thumbhash] ||= DEFAULT_OPTIONS.dup
16
20
  uploader.opts[:thumbhash].merge!(opts)
17
- configure_image_loader(uploader.opts[:thumbhash]) if uploader.opts[:thumbhash][:image_loader_class].nil?
21
+ image_loader_option = uploader.opts[:thumbhash][:image_loader]
22
+
23
+ return unless IMAGE_LOADER_CHOICES.include?(image_loader_option)
24
+
25
+ configure_image_loader(uploader.opts[:thumbhash])
18
26
  end
19
27
 
20
28
  def self.configure_image_loader(opts)
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Shrine::Plugins::Thumbhash::VERSION
8
8
  spec.authors = ["takayamaki / fusagiko"]
9
9
  spec.email = ["24884114+takayamaki@users.noreply.github.com"]
10
+ spec.license = "MIT"
10
11
 
11
12
  spec.summary = "Shrine plugin for generate Thumbhash from image attachments"
12
13
  spec.homepage = "https://github.com/takayamaki/shrine-thumbhash"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-thumbhash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - takayamaki / fusagiko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-06 00:00:00.000000000 Z
11
+ date: 2023-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
@@ -59,7 +59,8 @@ files:
59
59
  - shrine-thumbhash.gemspec
60
60
  - sig/shrine/plugins/thumbhash.rbs
61
61
  homepage: https://github.com/takayamaki/shrine-thumbhash
62
- licenses: []
62
+ licenses:
63
+ - MIT
63
64
  metadata:
64
65
  allowed_push_host: https://rubygems.org
65
66
  homepage_uri: https://github.com/takayamaki/shrine-thumbhash