Sha256: 31f4843ba91d290f625f714ff7dc50ba67c9d01a6c5e091104a19353e76a041f
Contents?: true
Size: 529 Bytes
Versions: 20
Compression:
Stored size: 529 Bytes
Contents
require 'yaml' require 'fuzzy_hash' require 'bloomfilter' class Swearjar class Tester def initialize(config_file) data = YAML.load_file @tester = FuzzyHash.new data['regex'].each do |pattern, type| @tester[Regexp.new(pattern)] = type end data['simple'].each do |test, type| @tester[test] = type end end def scan(string, &block) string.scan(/\b[\b]+\b/, &block) end def profane?(string) scan(string) {|w| return true} end end end
Version data entries
20 entries across 20 versions & 3 rubygems