Skip to content

Instantly share code, notes, and snippets.

@seamusabshere
Created April 18, 2011 22:25
Show Gist options
  • Select an option

  • Save seamusabshere/926373 to your computer and use it in GitHub Desktop.

Select an option

Save seamusabshere/926373 to your computer and use it in GitHub Desktop.
how to make a whitelist in remote table
#!/usr/bin/env ruby
require 'rubygems'
require 'remote_table'
# include to_regexp stuff from https://gist.github.com/926425
def manufacturer_whitelist?(candidate)
@manufacturer_whitelist ||= RemoteTable.new(:url => AAAAAAA)
@manufacturer_whitelist.any? { |record| record['Manufacturer'].to_regexp.match(candidate) }
end
t = RemoteTable.new :url => BBBBBB,
:errata => { :url => CCCCCCC },
:select => lambda { |record| manufacturer_whitelist? record['Manufacturer'] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment