verbs 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -1
- data/lib/verbs/conjugator.rb +9 -17
- data/lib/verbs/version.rb +1 -1
- data/test/test_verbs.rb +18 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -70,7 +70,8 @@ Set this to a string to prepend the conjugated verb with it. When set to <tt>tru
|
|
70
70
|
* {Lingua::Conjugate}[http://cpansearch.perl.org/src/RWG/Lingua-EN-Conjugate-0.308/lib/Lingua/EN/Conjugate.pm]
|
71
71
|
* {Pat Byrd and Tom McKlin}[http://www2.gsu.edu/~wwwesl/egw/pluralsv.htm]
|
72
72
|
* {Rick Harrison}[http://www.rickharrison.com/language/aspect.html]
|
73
|
+
* {Anatoli Makarevich}[https://github.com/makaroni4] for {#6}[https://github.com/rossmeissl/verbs/pull/6]
|
73
74
|
|
74
75
|
== Copyright
|
75
76
|
|
76
|
-
Copyright (c)
|
77
|
+
Copyright (c) 2012 Andy Rossmeissl. See LICENSE for details.
|
data/lib/verbs/conjugator.rb
CHANGED
@@ -152,28 +152,20 @@ module Verbs
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def present_third_person_singular_form_for(verb)
|
155
|
-
infinitive =
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
if infinitive.to_s.match(/#{CONSONANT_PATTERN}y$/)
|
162
|
-
infinitive.to_s.gsub(/y$/, 'ies').to_sym
|
163
|
-
elsif infinitive.to_s.match(/[szx]$/) or infinitive.to_s.match(/[sc]h$/)
|
164
|
-
infinitive.to_s.concat('es').to_sym
|
155
|
+
infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s
|
156
|
+
|
157
|
+
if infinitive =~ /[a-z&&#{CONSONANT_PATTERN}]y$/i
|
158
|
+
infinitive[0..-2] + 'ies'
|
159
|
+
elsif infinitive =~ /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i
|
160
|
+
infinitive + 'es'
|
165
161
|
else
|
166
|
-
infinitive
|
162
|
+
infinitive + 's'
|
167
163
|
end
|
168
164
|
end
|
169
165
|
|
170
166
|
def regular_preterite_for(verb)
|
171
|
-
infinitive =
|
172
|
-
|
173
|
-
verb.infinitive
|
174
|
-
when String, Symbol
|
175
|
-
verb.to_sym
|
176
|
-
end
|
167
|
+
infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s
|
168
|
+
|
177
169
|
if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(verb)
|
178
170
|
regular_preterite_with_doubled_terminal_consonant_for verb
|
179
171
|
elsif verb.to_s.match(/#{CONSONANT_PATTERN}e$/) or verb.to_s.match(/ye$/) or verb.to_s.match(/oe$/) or verb.to_s.match(/nge$/) or verb.to_s.match(/ie$/) or verb.to_s.match(/ee$/)
|
data/lib/verbs/version.rb
CHANGED
data/test/test_verbs.rb
CHANGED
@@ -123,4 +123,22 @@ class TestVerbs < Test::Unit::TestCase
|
|
123
123
|
Verbs::Conjugator.conjugate(:accept, :mood => :imperative)
|
124
124
|
end
|
125
125
|
end
|
126
|
+
|
127
|
+
def test_s_forms
|
128
|
+
Verbs::Conjugator.with_options :person => :third, :tense => :present do |standard|
|
129
|
+
assert_equal 'does', standard.conjugate('do')
|
130
|
+
assert_equal 'flies', standard.conjugate('fly')
|
131
|
+
assert_equal 'assesses', standard.conjugate('assess')
|
132
|
+
assert_equal 'blushes', standard.conjugate('blush')
|
133
|
+
assert_equal 'catches', standard.conjugate('catch')
|
134
|
+
assert_equal 'fizzes', standard.conjugate('fizz')
|
135
|
+
assert_equal 'relaxes', standard.conjugate('relax')
|
136
|
+
assert_equal 'bakes', standard.conjugate('bake')
|
137
|
+
assert_equal 'calls', standard.conjugate('call')
|
138
|
+
assert_equal 'dies', standard.conjugate('die')
|
139
|
+
assert_equal 'glues', standard.conjugate('glue')
|
140
|
+
assert_equal 'moos', standard.conjugate('moo')
|
141
|
+
assert_equal 'changes', standard.conjugate('change')
|
142
|
+
end
|
143
|
+
end
|
126
144
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
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:
|
12
|
+
date: 2013-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bueller
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
segments:
|
100
100
|
- 0
|
101
|
-
hash: -
|
101
|
+
hash: -427894591
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash: -
|
110
|
+
hash: -427894591
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
113
|
rubygems_version: 1.8.24
|