lib/biomart/database.rb in biomart-0.1.2 vs lib/biomart/database.rb in biomart-0.1.3
- old
+ new
@@ -41,10 +41,19 @@
# Utility method to do the webservice call to the biomart server
# and collate/build the information about the datasets.
def fetch_datasets
url = @url + "?type=datasets&mart=#{@name}"
document = request( :url => url )
- tsv_data = CSV.parse( document, "\t" )
+ tsv_data = []
+
+ if CSV.const_defined? :Reader
+ # Ruby < 1.9 CSV code
+ tsv_data = CSV.parse( document, "\t" )
+ else
+ # Ruby >= 1.9 CSV code
+ tsv_data = CSV.parse( document, { :col_sep => "\t" } )
+ end
+
tsv_data.each do |t|
if t[1] and ( t[3] === "1" )
dataset_attr = {
"name" => t[1],
"displayName" => t[2],
\ No newline at end of file