testdata 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/testdata.rb +10 -10
  2. 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) File.open(s, 'r').read end
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(url)
139
+ method(('read_' + ext).to_sym).call(buffer)
135
140
  end
136
141
 
137
- def read_xml(url)
138
- open(url, 'UserAgent' => 'S-Rscript').read
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
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: testdata
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.5
5
+ version: 0.8.6
6
6
  platform: ruby
7
7
  authors: []
8
8