Sha256: ebefe66b99e17cddda094c69357cc023257ca4e1401dcb60bea3ca318c68e1eb

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Biomart
  # Class representation for a biomart filter. 
  # Will belong to a Biomart::Dataset.
  class Filter
    attr_reader :name, :display_name, :default_value, :qualifier, :type
    
    def initialize(args)
      @name            = args["internalName"]
      @display_name    = args["displayName"]
      @default         = args["defaultOn"] ? true : false
      @default_value   = args["defaultValue"]
      @hidden          = args["hideDisplay"] ? true : false
      @qualifier       = args["qualifier"]
      @type            = args["type"]
      @multiple_values = args["multipleValues"] ? true : false
      
      @type.downcase! unless @type.nil?
    end
    
    # Convenience method to see if this filter is hidden from 
    # the standard MartView interface.  Returns true/false.
    def hidden?
      @hidden
    end
    
    # Convenience method to see if this filter would be 
    # enabled by default in the standard MartView interface.
    # Returns true/false.
    def default?
      @default
    end
    
    # Convenience method to see if this filter allows multiple 
    # values to be passed to it.
    def multiple_values?
      @multiple_values
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
biomart-0.2.1 lib/biomart/filter.rb