magic 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/magic/database.rb +3 -5
- data/lib/magic/errors.rb +1 -1
- data/lib/magic/version.rb +1 -1
- data/test/test_magic.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b912f49d8acd299f3dcf5316599f40b6da452eee
|
4
|
+
data.tar.gz: 27308b8df81ae0ad7f43680d209e1c690b0a962c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffeb6e08ced56a8f6e05592f310764745dc6f88f6b804de128c9f26829365b212a9e2cc3a438bf988a5096e9e41c26787f701c7e8bf722d0a9b981a1e048291d
|
7
|
+
data.tar.gz: 4d24ffa3e98aac70151c7ce6fe121149dc4c6d4d2879becabd97dcd92105e7aa26ee668ed23c308d70738ad8d729ff7b2645c27733c4ea694840a005583c87fd
|
data/lib/magic/database.rb
CHANGED
@@ -29,12 +29,10 @@ module Magic
|
|
29
29
|
|
30
30
|
# Determine type of a file at given path
|
31
31
|
def file(filename)
|
32
|
-
|
33
|
-
raise Exception, "#{filename}: No such file or directory"
|
34
|
-
end
|
32
|
+
raise Errno::ENOENT, filename unless File.exists?(filename)
|
35
33
|
result = Api.magic_file(@magic_set, filename.to_s)
|
36
34
|
if result.null?
|
37
|
-
raise
|
35
|
+
raise Error, error
|
38
36
|
else
|
39
37
|
result.get_string(0)
|
40
38
|
end
|
@@ -44,7 +42,7 @@ module Magic
|
|
44
42
|
def buffer(string)
|
45
43
|
result = Api.magic_buffer(@magic_set, string, string.bytesize)
|
46
44
|
if result.null?
|
47
|
-
raise
|
45
|
+
raise Error, error
|
48
46
|
else
|
49
47
|
result.get_string(0)
|
50
48
|
end
|
data/lib/magic/errors.rb
CHANGED
data/lib/magic/version.rb
CHANGED
data/test/test_magic.rb
CHANGED