imogen 0.1.7 → 0.1.8

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
- SHA1:
3
- metadata.gz: 501d565f9750790ca1339cdb3ab5e13c4c8f1b88
4
- data.tar.gz: 53c8ca7c304e5f83e6450a5da27cd1a9d54ee666
2
+ SHA256:
3
+ metadata.gz: fa9d6f61ab8d5aa8f99517c1d4d638cf3a5cb508179d05cf8262bd24f796df35
4
+ data.tar.gz: 27dc10c53681b2fbd7ea25b258dd5d049c5bbf5b31dc4e01d16d25f829798300
5
5
  SHA512:
6
- metadata.gz: b02498db95b990e0d0d45d1760f409a16c13534f4728e0709d4e91fae99c4cbce7e96bf26c5c624e100762d5e69419e03471dc8daf8ede199eb3b776a4fdce0d
7
- data.tar.gz: 7734e6e312916a9f8098947881353308767f859285d6e5382d61311243524390608abce700e0f7554ea8f64098cb98d128c2c9911ba4077f0fc6eaab8eedd2b8
6
+ metadata.gz: f482b46a68ae037dd849cac3232ec7fe74a4902fde31a5c84c7ec323cbddb61a1138aa4192d58092b80acdbc0ae4475569e4d14bb4c17513d18cb8637cad5ae4
7
+ data.tar.gz: e54a8310bb1af53d1cb6f2287ea6aa23fade2cf51980cc3096dec7fe91844b77c982d46373df67c0028a385175e1276cc7deed5356515e695339cff912cf8bf3
@@ -3,10 +3,8 @@ module Iiif
3
3
  class Rotation < Transform
4
4
  RIGHT_ANGLES = [0,90,180,270]
5
5
  def get(rotate)
6
- if rotate.nil? or rotate.eql? '0'
7
- return nil
8
- end
9
- raise BadRequest.new("bad rotate #{rotate}") unless rotate =~ /^-?\d+$/
6
+ return nil if [nil, 0, '0'].include?(rotate)
7
+ raise BadRequest.new("bad rotate #{rotate}") unless rotate.to_s =~ /^-?\d+$/
10
8
  # negate offset because IIIF spec counts clockwise, FreeImage counterclockwise
11
9
  r = (rotate.to_i * -1) % 360
12
10
  r = r + 360 if r < 0
@@ -23,4 +21,4 @@ class Rotation < Transform
23
21
  end
24
22
  end
25
23
  end
26
- end
24
+ end
@@ -7,7 +7,9 @@ describe Imogen::Iiif::Rotation, type: :unit do
7
7
  subject {Imogen::Iiif::Rotation.new(@test_image)}
8
8
  describe "#get" do
9
9
  describe "with values mod 360 in 90 degree rotations" do
10
- it "should nil for 0 or nil" do
10
+ it "should nil for 0 or '0' or nil" do
11
+ expect(subject.get(0)).to be_nil
12
+ expect(subject.get(360)).to be_nil
11
13
  expect(subject.get("360")).to be_nil
12
14
  expect(subject.get("-360")).to be_nil
13
15
  expect(subject.get("0")).to be_nil
@@ -15,6 +17,7 @@ describe Imogen::Iiif::Rotation, type: :unit do
15
17
  end
16
18
  # IIIF rotation is opposite FreeImage
17
19
  it "should calculate for positive values" do
20
+ expect(subject.get(90)).to eql(270)
18
21
  expect(subject.get("90")).to eql(270)
19
22
  expect(subject.get("180")).to eql(180)
20
23
  expect(subject.get("270")).to eql(90)
@@ -22,6 +25,7 @@ describe Imogen::Iiif::Rotation, type: :unit do
22
25
  end
23
26
  # IIIF rotation is opposite FreeImage
24
27
  it "should calculate for negative values" do
28
+ expect(subject.get(-90)).to eql(90)
25
29
  expect(subject.get("-90")).to eql(90)
26
30
  expect(subject.get("-180")).to eql(180)
27
31
  expect(subject.get("-270")).to eql(270)
@@ -29,11 +33,12 @@ describe Imogen::Iiif::Rotation, type: :unit do
29
33
  end
30
34
  end
31
35
  it "should reject arbitrary integer and float values" do
32
- expect{subject.get("2")}.to raise_error Imogen::Iiif::BadRequest
33
- expect{subject.get("90.0")}.to raise_error Imogen::Iiif::BadRequest
36
+ expect{subject.get(2)}.to raise_error Imogen::Iiif::BadRequest
37
+ expect{subject.get("2")}.to raise_error Imogen::Iiif::BadRequest
38
+ expect{subject.get("90.0")}.to raise_error Imogen::Iiif::BadRequest
34
39
  end
35
40
  it "should reject bad values" do
36
- expect{subject.get("-2,")}.to raise_error Imogen::Iiif::BadRequest
41
+ expect{subject.get("-2,")}.to raise_error Imogen::Iiif::BadRequest
37
42
  end
38
43
  end
39
- end
44
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imogen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Armintor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-opencv
@@ -79,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.4.6
82
+ rubygems_version: 3.0.6
84
83
  signing_key:
85
84
  specification_version: 4
86
85
  summary: derivative generation via FreeImage and smart square thumbnail via OpenCV