image_optim 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/image_optim.gemspec +1 -1
- data/lib/image_optim.rb +4 -4
- metadata +3 -3
data/image_optim.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'image_optim'
|
5
|
-
s.version = '0.3.
|
5
|
+
s.version = '0.3.2'
|
6
6
|
s.summary = %q{Optimize images (jpeg, png, gif) using external utilities (advpng, gifsicle, jpegoptim, jpegtran, optipng, pngcrush, pngout)}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
data/lib/image_optim.rb
CHANGED
@@ -51,13 +51,14 @@ class ImageOptim
|
|
51
51
|
workers.replace workers.sort_by(&:run_priority)
|
52
52
|
end
|
53
53
|
|
54
|
-
threads =
|
54
|
+
threads = options.delete(:threads)
|
55
|
+
threads = case threads
|
55
56
|
when true, nil
|
56
57
|
Util.processor_count
|
57
58
|
when false
|
58
59
|
1
|
59
60
|
else
|
60
|
-
|
61
|
+
threads.to_i
|
61
62
|
end
|
62
63
|
@threads = limit_with_range(threads, 1..16)
|
63
64
|
|
@@ -129,10 +130,9 @@ class ImageOptim
|
|
129
130
|
private
|
130
131
|
|
131
132
|
def run_method_for(paths, method_name, &block)
|
132
|
-
method = method(method_name)
|
133
133
|
apply_threading(paths).map do |path|
|
134
134
|
path = ImagePath.new(path)
|
135
|
-
result =
|
135
|
+
result = send(method_name, path)
|
136
136
|
if block
|
137
137
|
block.call(path, result)
|
138
138
|
else
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_optim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Kuchin
|