hydra-file_characterization 0.2.4 → 0.2.5
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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac3f8bd5d49accc137edb199598480ee962e6e4a
|
4
|
+
data.tar.gz: ef7acd758a81951fedb2f859fa1b63f3e333ca48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82f738df066f04e8e5c85781475f663ee9d64070b907c7305803efdc847fe137e01ddd64d640b8185738050efdec2343fb0d74033632f5f25c34f1320adb3a76
|
7
|
+
data.tar.gz: bf4c51962ee5f7f34da4bd18e14331aafac3da2dad44eccd63b5b0baf8d0eecbebb134f79f06ef08a56b5d38a567de77acfcdcff9ae2e62484b336dff82ff35b
|
@@ -9,16 +9,14 @@ module Hydra::FileCharacterization
|
|
9
9
|
new(*args).call(&block)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
attr_reader :data, :filename
|
13
13
|
|
14
14
|
def initialize(data, filename)
|
15
|
-
|
15
|
+
self.data = data
|
16
16
|
@filename = filename
|
17
17
|
end
|
18
18
|
|
19
19
|
def call
|
20
|
-
return if data.nil?
|
21
|
-
data = data.read if data.respond_to?(:read)
|
22
20
|
f = Tempfile.new([File.basename(filename),File.extname(filename)])
|
23
21
|
begin
|
24
22
|
f.binmode
|
@@ -31,5 +29,11 @@ module Hydra::FileCharacterization
|
|
31
29
|
end
|
32
30
|
|
33
31
|
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def data=(value)
|
36
|
+
@data = value.respond_to?(:read) ? value.read : value
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|