class BioTable::NumericFilter

FIXME: we should have a faster version too

Public Class Methods

new(header) click to toggle source
# File lib/bio-table/filter.rb, line 153
def initialize header
  @header = header.map { |name| name.downcase }
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
# File lib/bio-table/filter.rb, line 168
def method_missing m, *args, &block
  if @header 
    i = @header.index(m.to_s)
    if i != nil
      # p @header,i
      return @values[i] 
    end
    raise "Unknown value (can not find column name '#{m}') in list '#{@header}'"
  end
  raise "Unknown method '#{m}'"
end
numeric(code, fields) click to toggle source
# File lib/bio-table/filter.rb, line 157
def numeric code, fields
  values = LazyValues.new(fields)
  value = values  # alias
  @values = values
  begin
    eval(code)
  rescue Exception
    $stderr.print "Failed to evaluate ",fields," with ",code,"\n"
    raise 
  end
end