syllabize 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/syllabize.rb +3 -3
- data/lib/syllabize/version.rb +1 -1
- data/spec/lib/syllabize_spec.rb +2 -1
- metadata +2 -2
data/lib/syllabize.rb
CHANGED
@@ -6,7 +6,7 @@ module Syllabize
|
|
6
6
|
attr_accessor :word, :exceptions_file
|
7
7
|
|
8
8
|
def initialize(word)
|
9
|
-
@word =
|
9
|
+
@word = strip_punctuation(word)
|
10
10
|
handle_non_string_input
|
11
11
|
load_exceptions
|
12
12
|
end
|
@@ -33,8 +33,8 @@ module Syllabize
|
|
33
33
|
File.dirname(__FILE__)
|
34
34
|
end unless respond_to?(:__dir__, true)
|
35
35
|
|
36
|
-
def
|
37
|
-
string.gsub(
|
36
|
+
def strip_punctuation(string)
|
37
|
+
string.gsub(/\W/,'')
|
38
38
|
end
|
39
39
|
|
40
40
|
def handle_non_string_input
|
data/lib/syllabize/version.rb
CHANGED
data/spec/lib/syllabize_spec.rb
CHANGED
@@ -114,7 +114,8 @@ describe Syllabize::Counter do
|
|
114
114
|
'cooperate' => 4,
|
115
115
|
'ways' => 1,
|
116
116
|
"Wayne's" => 1,
|
117
|
-
'basement' => 2
|
117
|
+
'basement' => 2,
|
118
|
+
'basement,' => 2
|
118
119
|
}.each do |word, actual|
|
119
120
|
count = Syllabize::Counter.new(word).count_syllables
|
120
121
|
expect(count).to eq(actual), "#{word} was not the correct number of syllables; expected #{actual}, was #{count}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syllabize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|