iiif_url 0.0.4 → 0.0.5
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/iiif_url.rb +27 -9
- data/lib/iiif_url/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: cdc59d4c9f29f74fd43a2f582c1ed495637278c6
|
4
|
+
data.tar.gz: 29453c9dbd90f47db47236a651d878957198284c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f2420a77aee79a19eb338fc19859bae398b73d7a66bda8cc551578b2ade779c12e24aa656fa7adc342054dc89dbea0e958b1a19eed785e48a672590d4c6f67
|
7
|
+
data.tar.gz: 1bb3fdafe0095008ce4483754dccc3153523823e2123f49c4ddcdc38a9643bd9fad5e804d80d60150105a2942793a4fb37f630d379c8bf592fa78220202507f8
|
data/lib/iiif_url.rb
CHANGED
@@ -102,15 +102,26 @@ class IiifUrl
|
|
102
102
|
quality, format = quality_format.split('.')
|
103
103
|
|
104
104
|
rotation_string = url_parts.pop
|
105
|
-
rotation =
|
106
|
-
|
107
|
-
|
105
|
+
rotation = {}
|
106
|
+
rotation[:mirror] = if rotation_string.include?('!')
|
107
|
+
rotation_string.sub!('!', '')
|
108
|
+
true
|
108
109
|
else
|
109
|
-
|
110
|
+
false
|
111
|
+
end
|
112
|
+
rotation[:degrees] = if is_number?(rotation_string)
|
113
|
+
rotation_string.to_i
|
114
|
+
else
|
115
|
+
rotation_string
|
110
116
|
end
|
111
117
|
|
112
118
|
size_string = url_parts.pop
|
113
|
-
size =
|
119
|
+
size = {}
|
120
|
+
if size_string =~ /^!\d+,\d+/
|
121
|
+
size[:confined] = true
|
122
|
+
size_string.gsub!('!', '')
|
123
|
+
end
|
124
|
+
if size_string.include?(',')
|
114
125
|
w, h = size_string.split(',')
|
115
126
|
w = if w.empty?
|
116
127
|
nil
|
@@ -118,12 +129,13 @@ class IiifUrl
|
|
118
129
|
w.to_i
|
119
130
|
end
|
120
131
|
h = h.to_i if !h.nil?
|
121
|
-
|
132
|
+
size[:w] = w
|
133
|
+
size[:h] = h
|
122
134
|
elsif size_string.include?('pct')
|
123
|
-
pct,
|
124
|
-
|
135
|
+
pct, pct_size = size_string.split(':')
|
136
|
+
size[:pct] = pct_size.to_f
|
125
137
|
else
|
126
|
-
size_string
|
138
|
+
size = size_string
|
127
139
|
end
|
128
140
|
|
129
141
|
region_string = url_parts.pop
|
@@ -152,4 +164,10 @@ class IiifUrl
|
|
152
164
|
format: format
|
153
165
|
}
|
154
166
|
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
def self.is_number?(string)
|
171
|
+
true if Float(string) rescue false
|
172
|
+
end
|
155
173
|
end
|
data/lib/iiif_url/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iiif_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Ronallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|