dynarex 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynarex.rb +15 -5
- metadata +1 -1
data/lib/dynarex.rb
CHANGED
@@ -19,7 +19,18 @@ class Dynarex
|
|
19
19
|
@records
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def to_xml
|
23
|
+
display_xml()
|
24
|
+
end
|
25
|
+
|
26
|
+
def save(filepath)
|
27
|
+
xml = display_xml()
|
28
|
+
File.open(filepath,'w'){|f| f.write xml}
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def display_xml
|
23
34
|
|
24
35
|
xml = Builder::XmlMarkup.new( :target => buffer='', :indent => 2 )
|
25
36
|
xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
|
@@ -37,13 +48,12 @@ class Dynarex
|
|
37
48
|
end
|
38
49
|
end
|
39
50
|
end
|
40
|
-
end
|
51
|
+
end
|
52
|
+
|
53
|
+
buffer
|
41
54
|
|
42
|
-
File.open(filepath,'w'){|f| f.write buffer}
|
43
55
|
end
|
44
56
|
|
45
|
-
private
|
46
|
-
|
47
57
|
def open(location)
|
48
58
|
if location[/^https?:\/\//] then
|
49
59
|
buffer = Kernel.open(location, 'UserAgent' => 'Dynarex-Reader').read
|