Skip to content
This repository
Browse code

Handle boolean filters when set on as default

  • Loading branch information...
commit aa7c0996e5b15a5352e5e187e53350ec4b228bca 1 parent 73a5a59
authored February 16, 2011

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  lib/biomart/dataset.rb
10  lib/biomart/dataset.rb
@@ -251,9 +251,9 @@ def dataset_xml( xml, dataset, args )
251 251
               raise Biomart::ArgumentError, "The filter '#{name}' does not exist" if dataset.filters[name].nil?
252 252
               
253 253
               if dataset.filters[name].type == 'boolean'
254  
-                if [true,'included','only'].include?(value)
  254
+                if [true,'included','only'].include?(value.downcase)
255 255
                   xml.Filter( :name => name, :excluded => '0' )
256  
-                elsif [false,'excluded'].include?(value)
  256
+                elsif [false,'excluded'].include?(value.downcase)
257 257
                   xml.Filter( :name => name, :excluded => '1' )
258 258
                 else
259 259
                   raise Biomart::ArgumentError, "The boolean filter '#{name}' can only accept 'true/included/only' or 'false/excluded' arguments."
@@ -266,7 +266,11 @@ def dataset_xml( xml, dataset, args )
266 266
           else
267 267
             dataset.filters.each do |name,filter|
268 268
               if filter.default?
269  
-                xml.Filter( :name => name, :value => filter.default_value )
  269
+                if filter.type == 'boolean'
  270
+                  xml.Filter( :name => name, :excluded => filter.default_value )
  271
+                else
  272
+                  xml.Filter( :name => name, :value => filter.default_value )
  273
+                end
270 274
               end
271 275
             end
272 276
           end

0 notes on commit aa7c099

Please sign in to comment.
Something went wrong with that request. Please try again.