mannie-taverna-t2flow 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/t2flow/parser.rb +8 -4
- metadata +1 -1
data/README
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Taverna[http://taverna.sourceforge.net] 2 Interaction Gem
|
2
2
|
|
3
3
|
Author:: Emmanuel Tagarira
|
4
|
-
Version:: 0.0.
|
4
|
+
Version:: 0.0.2
|
5
5
|
Contact:: mailto:emmanuel.tagarira@student.manchester.ac.uk
|
6
6
|
URL:: http://taverna.sourceforge.net/
|
7
7
|
Licence:: LGPL 3 (See LICENCE or http://www.gnu.org/licenses/lgpl.html)
|
data/lib/t2flow/parser.rb
CHANGED
@@ -4,15 +4,19 @@ module T2Flow
|
|
4
4
|
|
5
5
|
class Parser
|
6
6
|
# Returns the model for the given t2flow_file.
|
7
|
-
# The method accepts objects of classes File and String only.
|
7
|
+
# The method accepts objects of classes File, StringIO and String only.
|
8
8
|
# ===Usage
|
9
9
|
# foo = ... # stuff to initialize foo here
|
10
10
|
# bar = T2Flow::Parser.new.parse(foo)
|
11
11
|
def parse(t2flow)
|
12
12
|
case t2flow.class.to_s
|
13
|
-
when
|
14
|
-
|
15
|
-
|
13
|
+
when /^string$/i
|
14
|
+
document = LibXML::XML::Parser.string(t2flow).parse
|
15
|
+
when /^stringio|file$/i
|
16
|
+
t2flow.rewind
|
17
|
+
document = LibXML::XML::Parser.string(t2flow.read).parse
|
18
|
+
else
|
19
|
+
raise "Error parsing file."
|
16
20
|
end
|
17
21
|
|
18
22
|
root = document.root
|