Created
April 18, 2011 22:25
-
-
Save seamusabshere/926373 to your computer and use it in GitHub Desktop.
how to make a whitelist in remote table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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