aspect_ratio 1.0.2 → 1.0.4
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/aspect_ratio.gemspec +2 -2
- data/lib/aspect_ratio.rb +10 -10
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd85391060dc95f2bcb3e239cfd71e2e355c36aabeba1125b6c831b0f89ad6c
|
4
|
+
data.tar.gz: 1aa2961f79d46ae905bf47882d9ffc74630baca1c0de7bb40cc01a123b1715a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16dafe9d8f7d3978932d57ceee8c35bf189c692cda098f5cdd0a7dd0acd3d8c0008a05f4f1f0a0d1dcc7764fc78e374da8f67ed757862bf1963522ef85d7cbc5
|
7
|
+
data.tar.gz: 71a886634e7b26817661ed8f90ea8ffcffc7f0150fafd02ded29a0d0dd6c89bc3460732771a168a5d5af2ac08ceef3be475f425d3448b265b113664a874b5682
|
data/aspect_ratio.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'aspect_ratio'
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.4'
|
7
7
|
s.date = '2016-04-26'
|
8
8
|
s.summary = 'Image aspect ratio calculation utility'
|
9
9
|
s.description = 'Image aspect ratio calculation utility'
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.license = 'MIT'
|
15
15
|
|
16
16
|
s.require_paths = ['lib']
|
17
|
-
s.required_ruby_version = '>= 2.
|
17
|
+
s.required_ruby_version = '>= 2.4.0'
|
18
18
|
s.test_files = s.files.grep(%r{^(test)/})
|
19
19
|
|
20
20
|
s.add_development_dependency 'minitest', '~> 5'
|
data/lib/aspect_ratio.rb
CHANGED
@@ -55,22 +55,22 @@ module AspectRatio
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
delta_x = ((x - xʹ) / 2).to_f.floor
|
59
|
+
delta_y = ((y - yʹ) / 2).to_f.floor
|
60
60
|
|
61
61
|
if (vertical || rotate) && !(vertical && rotate)
|
62
62
|
[
|
63
|
-
|
64
|
-
|
65
|
-
y -
|
66
|
-
x -
|
63
|
+
delta_y, # crop top left x
|
64
|
+
delta_x, # crop top left y
|
65
|
+
y - delta_y * 2, # crop width
|
66
|
+
x - delta_x * 2 # crop height
|
67
67
|
]
|
68
68
|
else
|
69
69
|
[
|
70
|
-
|
71
|
-
|
72
|
-
x -
|
73
|
-
y -
|
70
|
+
delta_x.to_f, # crop top left x
|
71
|
+
delta_y, # crop top left y
|
72
|
+
x - delta_x * 2, # crop width
|
73
|
+
y - delta_y * 2 # crop height
|
74
74
|
]
|
75
75
|
end
|
76
76
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspect_ratio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trung Lê
|
@@ -46,15 +46,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 2.
|
49
|
+
version: 2.4.0
|
50
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
|
-
|
57
|
-
rubygems_version: 2.7.3
|
56
|
+
rubygems_version: 3.0.3
|
58
57
|
signing_key:
|
59
58
|
specification_version: 4
|
60
59
|
summary: Image aspect ratio calculation utility
|