hydra-file_characterization 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hydra/file_characterization.rb +16 -2
- data/lib/hydra/file_characterization/version.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: 2274d4a30e9297d0a50618e43cf37a32b61c636b
|
4
|
+
data.tar.gz: 95f2b5c7c203375348c299ace5ffa8a70dfc8138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46f13a52337a8251753768fbd6de683ebd9d0d61242a3a4e5600d70f388ddf04fb173eadc9489c49799d2836f755e4d92b11e6a0e43b4d0a2bc54a4cbd2b1ce8
|
7
|
+
data.tar.gz: 220e1e5c34ed0cf3286d8e7efa47146306d03ebc3d1cff491e177d5fc31ca48a645995a45c313d0e5d931d5e8bcb15a10688ce60fa1bb4349ce536ef3a7a9a00
|
@@ -8,9 +8,23 @@ require "active_support/configurable"
|
|
8
8
|
module Hydra
|
9
9
|
|
10
10
|
module_function
|
11
|
-
|
11
|
+
|
12
|
+
#
|
13
|
+
# Run all of the specified tools against the given content and filename.
|
14
|
+
#
|
15
|
+
# @param [String] content - The contents of the original file
|
16
|
+
# @param [String] filename - The original file's filename; Some
|
17
|
+
# characterization tools take hints from the file names
|
18
|
+
# @param [Array] tool_names - A list of tool names available on the system
|
19
|
+
#
|
20
|
+
# @return [String, Array<String>] -
|
21
|
+
# String - When a single tool_name is given, returns the raw XML as a
|
22
|
+
# string
|
23
|
+
# Array<String> - When multiple tool_names are given, returns an equal
|
24
|
+
# length Array of XML strings
|
25
|
+
def characterize(content, filename, *tool_names)
|
12
26
|
tool_outputs = []
|
13
|
-
tool_names = Array(
|
27
|
+
tool_names = Array(tool_names).flatten.compact
|
14
28
|
FileCharacterization::ToTempFile.open(content, filename) do |f|
|
15
29
|
tool_names.each do |tool_name|
|
16
30
|
tool_outputs << FileCharacterization.characterize_with(tool_name, f.path)
|