Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
Handle boolean filters when set on as default
Browse files Browse the repository at this point in the history
  • Loading branch information
Daz Oakley committed Feb 16, 2011
1 parent 73a5a59 commit aa7c099
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/biomart/dataset.rb
Expand Up @@ -251,9 +251,9 @@ def dataset_xml( xml, dataset, args )
raise Biomart::ArgumentError, "The filter '#{name}' does not exist" if dataset.filters[name].nil? raise Biomart::ArgumentError, "The filter '#{name}' does not exist" if dataset.filters[name].nil?


if dataset.filters[name].type == 'boolean' if dataset.filters[name].type == 'boolean'
if [true,'included','only'].include?(value) if [true,'included','only'].include?(value.downcase)
xml.Filter( :name => name, :excluded => '0' ) xml.Filter( :name => name, :excluded => '0' )
elsif [false,'excluded'].include?(value) elsif [false,'excluded'].include?(value.downcase)
xml.Filter( :name => name, :excluded => '1' ) xml.Filter( :name => name, :excluded => '1' )
else else
raise Biomart::ArgumentError, "The boolean filter '#{name}' can only accept 'true/included/only' or 'false/excluded' arguments." raise Biomart::ArgumentError, "The boolean filter '#{name}' can only accept 'true/included/only' or 'false/excluded' arguments."
Expand All @@ -266,7 +266,11 @@ def dataset_xml( xml, dataset, args )
else else
dataset.filters.each do |name,filter| dataset.filters.each do |name,filter|
if filter.default? if filter.default?
xml.Filter( :name => name, :value => filter.default_value ) if filter.type == 'boolean'
xml.Filter( :name => name, :excluded => filter.default_value )
else
xml.Filter( :name => name, :value => filter.default_value )
end
end end
end end
end end
Expand Down

0 comments on commit aa7c099

Please sign in to comment.