fastimage 1.2.12 → 1.2.13
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/lib/fastimage.rb +10 -1
- metadata +16 -3
data/lib/fastimage.rb
CHANGED
@@ -246,6 +246,14 @@ class FastImage
|
|
246
246
|
send("parse_size_for_#{@type}")
|
247
247
|
end
|
248
248
|
|
249
|
+
def has_encoding?
|
250
|
+
if @has_encoding.nil?
|
251
|
+
@has_encoding = String.new.respond_to? :force_encoding
|
252
|
+
else
|
253
|
+
@has_encoding
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
249
257
|
def get_chars(n)
|
250
258
|
if @strpos + n - 1 >= @str.size
|
251
259
|
@unused_str = @str[@strpos..-1]
|
@@ -253,7 +261,8 @@ class FastImage
|
|
253
261
|
else
|
254
262
|
result = @str[@strpos..(@strpos + n - 1)]
|
255
263
|
@strpos += n
|
256
|
-
|
264
|
+
# we are dealing with bytes here, so force the encoding
|
265
|
+
has_encoding? ? result.force_encoding("ASCII-8BIT") : result
|
257
266
|
end
|
258
267
|
end
|
259
268
|
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 5
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 13
|
10
|
+
version: 1.2.13
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Stephen Sykes
|
@@ -10,7 +15,8 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-03-22 00:00:00
|
18
|
+
date: 2012-03-22 00:00:00 +02:00
|
19
|
+
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
16
22
|
description: FastImage finds the size or type of an image given its uri by fetching as little as needed.
|
@@ -37,6 +43,7 @@ files:
|
|
37
43
|
- test/fixtures/test2.jpg
|
38
44
|
- test/fixtures/test3.jpg
|
39
45
|
- test/test.rb
|
46
|
+
has_rdoc: true
|
40
47
|
homepage: http://github.com/sdsykes/fastimage
|
41
48
|
licenses: []
|
42
49
|
|
@@ -50,17 +57,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
57
|
requirements:
|
51
58
|
- - ">="
|
52
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
53
63
|
version: "0"
|
54
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
65
|
none: false
|
56
66
|
requirements:
|
57
67
|
- - ">="
|
58
68
|
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
59
72
|
version: "0"
|
60
73
|
requirements: []
|
61
74
|
|
62
75
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.6.2
|
64
77
|
signing_key:
|
65
78
|
specification_version: 3
|
66
79
|
summary: FastImage - Image info fast
|