photo-cook 1.2.1 → 1.2.3
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.
- checksums.yaml +4 -4
- data/lib/photo-cook/pixels.rb +14 -2
- data/lib/photo-cook/resize/__api__.rb +4 -4
- data/lib/photo-cook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 654d5fd2b8fe7bd8b296817062dc007a661aca94
|
|
4
|
+
data.tar.gz: 4522e68c06b3955db4b81e08beed6bdfb3131e7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa5c419b8b1c9dec864a590deaf2d494c0cabc508241d9a740d8261d57a2538fa86e5628301c032a928bd1f58ed4900cc959e8c10db6f2dcba739c07ce245503
|
|
7
|
+
data.tar.gz: 84912264a46fb54cadcedfd6dc8c66979cc67021dbc7c9e1684f74ea8a5cf7f2061ac9231c8891492d6e042770065e5f64f2315566c1825ec966d21ac0bbbca6
|
data/lib/photo-cook/pixels.rb
CHANGED
|
@@ -13,10 +13,10 @@ module PhotoCook
|
|
|
13
13
|
x
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def check!(x)
|
|
16
|
+
def check!(x, ensure_in_bounds = true)
|
|
17
17
|
x = typecast(x)
|
|
18
18
|
raise Invalid, x if !x.kind_of?(Integer) && (x.nan? || x.infinite?)
|
|
19
|
-
raise OutOfBounds, x
|
|
19
|
+
raise OutOfBounds, x if ensure_in_bounds && !in_bounds?(x)
|
|
20
20
|
true
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -54,3 +54,15 @@ module PhotoCook
|
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
|
+
|
|
58
|
+
class Float
|
|
59
|
+
def round_pixels
|
|
60
|
+
PhotoCook::Pixels.round(self)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Fixnum
|
|
65
|
+
def round_pixels
|
|
66
|
+
self
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -32,7 +32,7 @@ module PhotoCook
|
|
|
32
32
|
#
|
|
33
33
|
# NOTE: This method will perform validation
|
|
34
34
|
def uri(uri, width, height, mode, options = {})
|
|
35
|
-
Assemble.assemble_resize_uri(uri, *parse_options(width, height, mode, options))
|
|
35
|
+
Assemble.assemble_resize_uri(uri, *parse_options(width, height, mode, options, false))
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# Inverse of PhotoCook#resize (see ^):
|
|
@@ -79,13 +79,13 @@ module PhotoCook
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
def parse_options(width, height, mode, options)
|
|
82
|
+
def parse_options(width, height, mode, options, check_pixels_in_bounds = true)
|
|
83
83
|
multiplier = options.fetch(:multiplier, self.multiplier).to_f
|
|
84
84
|
mode = Mode.parse!(mode)
|
|
85
85
|
width = Pixels.round(Pixels.parse(width) * multiplier)
|
|
86
86
|
height = Pixels.round(Pixels.parse(height) * multiplier)
|
|
87
|
-
Pixels.check!(width)
|
|
88
|
-
Pixels.check!(height)
|
|
87
|
+
Pixels.check!(width, check_pixels_in_bounds)
|
|
88
|
+
Pixels.check!(height, check_pixels_in_bounds)
|
|
89
89
|
[width, height, mode]
|
|
90
90
|
end
|
|
91
91
|
end
|
data/lib/photo-cook/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: photo-cook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Konoplov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-10-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|