Created
September 30, 2011 04:04
-
-
Save rdammkoehler/1252611 to your computer and use it in GitHub Desktop.
So I worked this out for something at work, but I'm concerned it isn't readable. What do you think?
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
| require 'set' | |
| class FileParser | |
| def initialize filename | |
| @set = IO.readlines(filename).collect{ |s| s.split(',').map!{ |t| t.strip } }.flatten.to_set | |
| end | |
| def match? value | |
| @set.include? value | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I ended up with this, after your comments;