Text 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/rakefile.rb +1 -1
- data/test/test_double_metaphone.rb +10 -3
- metadata +1 -1
data/rakefile.rb
CHANGED
@@ -9,7 +9,7 @@ require 'rake/rdoctask'
|
|
9
9
|
|
10
10
|
gemspec = Gem::Specification.new do |s|
|
11
11
|
s.name = 'Text'
|
12
|
-
s.version = '1.1.
|
12
|
+
s.version = '1.1.2'
|
13
13
|
s.summary ='A collection of text algorithms'
|
14
14
|
s.files = FileList['{lib,test}/**/*.*', 'README.rdoc', 'rakefile.rb']
|
15
15
|
s.require_path = 'lib'
|
@@ -1,11 +1,18 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'preamble')
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems' rescue nil
|
5
|
+
require 'fastercsv'
|
6
|
+
METHOD = [ FasterCSV, :foreach, { :col_sep => ', ' } ]
|
7
|
+
rescue LoadError
|
8
|
+
require 'csv'
|
9
|
+
METHOD = [ CSV, :open, 'r', ', ' ]
|
10
|
+
end
|
4
11
|
|
5
12
|
class DoubleMetaphoneTest < Test::Unit::TestCase
|
6
13
|
|
7
14
|
def test_cases
|
8
|
-
|
15
|
+
METHOD.shift.send(METHOD.shift, File.rel('data', 'double_metaphone.csv'), *METHOD) do |row|
|
9
16
|
primary, secondary = Text::Metaphone.double_metaphone(row[0])
|
10
17
|
|
11
18
|
assert_equal row[1], primary
|