Permalink
Browse files

matching is case-invariant

  • Loading branch information...
joshbuddy committed May 19, 2010
1 parent 71d4156 commit 36b49068ef82d63efd954dce7ba6a9ec57e6902b
Showing with 60 additions and 1 deletion.
  1. +1 −1 lib/swearjar.rb
  2. +4 −0 spec/swearjar_spec.rb
  3. +55 −0 swearjar.gemspec
View
@@ -32,7 +32,7 @@ def initialize(file)
def scan(string, &block)
string.scan(/\b[a-zA-Z-]+\b/) do |word|
- block.call(word, hash[word])
+ block.call(word, hash[word.downcase])
end
if match = tester.match_with_result(string)
block.call(match.last, match.first)
View
@@ -6,6 +6,10 @@
Swearjar.default.profane?('fuck you jim henson').should be_true
end
+ it "should detect dirty words regardless of case" do
+ Swearjar.default.profane?('FuCk you jim henson').should be_true
+ end
+
it "should not detect non-dirty words" do
Swearjar.default.profane?('i love you jim henson').should be_false
end
View
@@ -0,0 +1,55 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{swearjar}
+ s.version = "0.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Joshua Hull"]
+ s.date = %q{2010-01-13}
+ s.description = %q{Put another nickel in the swearjar.}
+ s.email = %q{joshbuddy@gmail.com}
+ s.extra_rdoc_files = [
+ "README.rdoc"
+ ]
+ s.files = [
+ "README.rdoc",
+ "Rakefile",
+ "VERSION",
+ "config/en.yml",
+ "lib/swearjar.rb",
+ "lib/swearjar/tester.rb",
+ "spec/spec.opts",
+ "spec/spec_helper.rb",
+ "spec/swearjar_spec.rb"
+ ]
+ s.homepage = %q{http://github.com/joshbuddy/swearjar}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.5}
+ s.summary = %q{Put another nickel in the swearjar.}
+ s.test_files = [
+ "spec/spec_helper.rb",
+ "spec/swearjar_spec.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<fuzzyhash>, [">= 0.0.11"])
+ s.add_runtime_dependency(%q<dirge>, [">= 0.0.3"])
+ else
+ s.add_dependency(%q<fuzzyhash>, [">= 0.0.11"])
+ s.add_dependency(%q<dirge>, [">= 0.0.3"])
+ end
+ else
+ s.add_dependency(%q<fuzzyhash>, [">= 0.0.11"])
+ s.add_dependency(%q<dirge>, [">= 0.0.3"])
+ end
+end
+

0 comments on commit 36b4906

Please sign in to comment.