saintly 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -8,4 +8,9 @@
8
8
 
9
9
  === 0.1.3 / 2010-06-30
10
10
 
11
- * Case insensitive
11
+ * Case insensitive
12
+
13
+ === 0.1.4 / 2010-07-08
14
+
15
+ * Allows are partials, makes it easier to accept plurals
16
+
data/lib/saintly.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Saintly
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
 
4
4
  def self.sanitize(text)
5
5
  return if text.nil?
6
- text.gsub(exclude_regex){|m| ALLOWED_WORDS.include?(m) ? m : '*' * m.length}
6
+ r = Regexp.new(ALLOWED_WORDS.join('|'))
7
+ text.gsub(exclude_regex){|m| r.match(m).nil? ? '*' * m.length : m }
7
8
  end
8
9
 
9
10
  private
@@ -17,7 +18,7 @@ module Saintly
17
18
  end
18
19
 
19
20
 
20
- ALLOWED_WORDS = [ 'glass', 'scunthorpe', 'assume', 'assumption', 'assassin', 'assassinate', 'shitake']
21
+ ALLOWED_WORDS = [ 'glass', 'scunthorpe', 'assume', 'assumption', 'assassin', 'asset', 'assassinate', 'shitake']
21
22
 
22
23
 
23
24
  RESTRICTED_PARTIALS = [
data/test/saintly_test.rb CHANGED
@@ -37,6 +37,8 @@ class SaintlyTest < Test::Unit::TestCase
37
37
 
38
38
  assert_equal 'scunthorpe', Saintly.sanitize('scunthorpe')
39
39
  assert_equal 'lightwater', Saintly.sanitize('lightwater')
40
+
41
+ assert_equal 'assets', Saintly.sanitize('assets')
40
42
  end
41
43
 
42
44
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saintly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Coyne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-30 00:00:00 -05:00
18
+ date: 2010-07-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency