testdata 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testdata.rb +10 -10
- metadata +1 -1
data/lib/testdata.rb
CHANGED
@@ -126,21 +126,21 @@ class Testdata
|
|
126
126
|
def tests(*args)
|
127
127
|
# override this method in the child class
|
128
128
|
end
|
129
|
-
|
130
|
-
def read_file(s)
|
129
|
+
|
130
|
+
def read_file(s)
|
131
|
+
buffer = File.open(s, 'r').read
|
132
|
+
ext = url[/\.(\w+)$/,1]
|
133
|
+
method(('read_' + ext).to_sym).call(buffer)
|
134
|
+
end
|
131
135
|
|
132
136
|
def read_url(url)
|
137
|
+
buffer = open(url, 'UserAgent' => 'Testdata').read
|
133
138
|
ext = url[/.*\/[^\.]+\.(\w+)/,1]
|
134
|
-
method(('read_' + ext).to_sym).call(
|
139
|
+
method(('read_' + ext).to_sym).call(buffer)
|
135
140
|
end
|
136
141
|
|
137
|
-
def read_xml(
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
def read_td(url)
|
142
|
-
txt = open(url, 'UserAgent' => 'Testdata').read
|
143
|
-
TestdataText.parse(txt)
|
142
|
+
def read_xml(buffer)
|
143
|
+
buffer
|
144
144
|
end
|
145
145
|
|
146
146
|
|