verbs 2.1.4 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f0be8c541f264896e8f106be8bd64f97504c6261
4
- data.tar.gz: 654aee13d012ace83b367b599edaf43b35a03fb8
2
+ SHA256:
3
+ metadata.gz: 1f3cb83b9097ea8bf2c6535df39c6bec057723e6ba9d9656fea24d07c408669d
4
+ data.tar.gz: 843f283457646d40e231aca31596583bf6d6de0aa010475fbc69646b08e4f4f8
5
5
  SHA512:
6
- metadata.gz: 4b248c62b8c8b6ce14f144bf1bd719471d09ee0303ca68872e9635ee3e914b624cdb15a4baac647415e5080cc6b015d9174a31b7a2332ebdb1d933ee63711d85
7
- data.tar.gz: fdbb938f6809c81ef825d16b9f3ff62bec2740efe75e6629833a58c7fd766df90259c243c37ab9e0a72f0d4d0311a3b50fb6927c5c5c73a27808a13752d1bded
6
+ metadata.gz: ce1045dc949010c62482dc97a5d65964d12779a772855cac9fe504cc7e26b9e735281934926b13306f43dc843cba58bae7088b2548a7211b7416756471d8fdf8
7
+ data.tar.gz: 8dc5fb226b59469fb5264210dcc88ed7dad49ed568f02b603299ee8cd0815a161512860a8b4315cd81c9ecea6a918238bc3736c6b8cf7f87d526e0d20183288e
@@ -1,6 +1,6 @@
1
1
  Verbs::Conjugator.conjugations do |conjugate|
2
2
 
3
- conjugate.irregular :be do |verb| # copular
3
+ conjugate.irregular :be do |verb| # copular
4
4
  verb.form :am, :tense => :present, :person => :first, :plurality => :singular
5
5
  verb.form :is, :tense => :present, :person => :third, :plurality => :singular
6
6
  verb.form :are, :tense => :present, :person => :second, :plurality => :singular
@@ -17,7 +17,7 @@ Verbs::Conjugator.conjugations do |conjugate|
17
17
  verb.form :been, :tense => :past, :derivative => :participle
18
18
  end
19
19
 
20
- conjugate.irregular :have do |verb|
20
+ conjugate.irregular :have do |verb|
21
21
  verb.form :have, :tense => :present, :person => :first, :plurality => :singular
22
22
  verb.form :has, :tense => :present, :person => :third, :plurality => :singular
23
23
  verb.form :have, :tense => :present, :person => :second, :plurality => :singular
@@ -182,7 +182,7 @@ Verbs::Conjugator.conjugations do |conjugate|
182
182
  conjugate.irregular :strive, :strove, :striven
183
183
  conjugate.irregular :swear, :swore, :sworn
184
184
  conjugate.irregular :sweep, :swept, :swept
185
- conjugate.irregular :swell, :swelled, :swelled
185
+ conjugate.irregular :swell, :swelled, :swelled
186
186
  conjugate.irregular :swim, :swam, :swum
187
187
  conjugate.irregular :swing, :swung, :swung
188
188
  conjugate.irregular :take, :took, :taken
@@ -264,6 +264,7 @@ Verbs::Conjugator.conjugations do |conjugate|
264
264
  conjugate.single_terminal_consonant :decipher
265
265
  conjugate.single_terminal_consonant :deflower
266
266
  conjugate.single_terminal_consonant :delimit
267
+ conjugate.single_terminal_consonant :deliver
267
268
  conjugate.single_terminal_consonant :deposit
268
269
  conjugate.single_terminal_consonant :develop
269
270
  conjugate.single_terminal_consonant :differ
@@ -309,6 +310,7 @@ Verbs::Conjugator.conjugations do |conjugate|
309
310
  conjugate.single_terminal_consonant :flounder
310
311
  conjugate.single_terminal_consonant :fluster
311
312
  conjugate.single_terminal_consonant :flutter
313
+ conjugate.single_terminal_consonant :follow
312
314
  conjugate.single_terminal_consonant :foreshorten
313
315
  conjugate.single_terminal_consonant :founder
314
316
  conjugate.single_terminal_consonant :fritter
@@ -35,15 +35,17 @@ module Verbs
35
35
  end
36
36
 
37
37
  def conjugate(infinitive, options = {})
38
+ infinitive = infinitive.dup if infinitive.is_a?(String)
39
+
38
40
  tense = options[:tense] || :present # present, past, future
39
41
  person = options[:person] || :third # first, second, third
40
42
  plurality = options[:plurality] || :singular # singular, plural
41
43
  diathesis = options[:diathesis] || :active # active, passive
42
44
  mood = options[:mood] || :indicative # imperative, subjunctive
43
45
  aspect = options[:aspect] || :habitual # perfective, habitual, progressive, perfect, prospective
44
-
46
+
45
47
  check_for_improper_constructions(tense, person, mood)
46
-
48
+
47
49
  form = form_for(tense, aspect)
48
50
 
49
51
  conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip
@@ -109,11 +111,11 @@ module Verbs
109
111
  end
110
112
 
111
113
  def present_participle(infinitive)
112
- if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(infinitive)
114
+ if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(infinitive.to_sym)
113
115
  present_participle_with_doubled_terminal_consonant_for infinitive
114
116
  elsif infinitive.to_s.match(/c$/)
115
117
  infinitive.to_s.concat('king').to_sym
116
- elsif infinitive.to_s.match(/ye$/) or infinitive.to_s.match(/oe$/) or infinitive.to_s.match(/nge$/) or infinitive.to_s.match(/ee$/)
118
+ elsif infinitive.to_s.match(/^be$/) or infinitive.to_s.match(/ye$/) or infinitive.to_s.match(/oe$/) or infinitive.to_s.match(/nge$/) or infinitive.to_s.match(/ee$/)
117
119
  infinitive.to_s.concat('ing').to_sym
118
120
  elsif infinitive.to_s.match(/ie$/)
119
121
  infinitive.to_s[0..-2].concat('ying').to_sym
@@ -167,8 +169,8 @@ module Verbs
167
169
 
168
170
  def regular_preterite_for(verb)
169
171
  infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s
170
-
171
- if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(verb)
172
+
173
+ if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(verb.to_sym)
172
174
  regular_preterite_with_doubled_terminal_consonant_for verb
173
175
  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$/)
174
176
  infinitive.to_s.concat('d').to_sym
@@ -207,7 +209,7 @@ module Verbs
207
209
  end
208
210
  form
209
211
  end
210
-
212
+
211
213
  def check_for_improper_constructions(tense, person, mood)
212
214
  if mood == :imperative and not (person == :second and tense == :present)
213
215
  raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'
@@ -1,3 +1,3 @@
1
1
  module Verbs
2
- VERSION = "2.1.4"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -12,6 +12,10 @@ class TestVerbs < Test::Unit::TestCase
12
12
  assert_equal 'was', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)
13
13
  assert_equal 'were', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :first, :plurality => :plural, :aspect => :perfective)
14
14
  assert_equal 'were', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :plural, :aspect => :perfective)
15
+
16
+ assert_equal 'was being', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :aspect => :progressive)
17
+ assert_equal 'is being', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :aspect => :progressive)
18
+ assert_equal 'will be being', Verbs::Conjugator.conjugate(:be, :tense => :future, :person => :third, :aspect => :progressive)
15
19
  end
16
20
  def test_irregular_conjugation
17
21
  assert_equal 'break', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :first, :plurality => :singular, :aspect => :habitual)
@@ -53,8 +57,10 @@ class TestVerbs < Test::Unit::TestCase
53
57
  end
54
58
  def test_regular_conjugation_with_irregular_terminal_consonant
55
59
  assert_equal 'abandoned', Verbs::Conjugator.conjugate(:abandon, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
60
+ assert_equal 'followed', Verbs::Conjugator.conjugate(:follow, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
56
61
  assert_equal 'triggered', Verbs::Conjugator.conjugate(:trigger, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
57
62
  assert_equal 'colored', Verbs::Conjugator.conjugate(:color, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
63
+ assert_equal 'delivered', Verbs::Conjugator.conjugate(:deliver, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
58
64
  end
59
65
  def test_regular_conjugation_with_ean_suffix
60
66
  assert_equal 'cleaned', Verbs::Conjugator.conjugate(:clean, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
@@ -144,4 +150,10 @@ class TestVerbs < Test::Unit::TestCase
144
150
  assert_equal 'changes', standard.conjugate('change')
145
151
  end
146
152
  end
153
+
154
+ def test_immutability
155
+ verb = 'like'
156
+ Verbs::Conjugator.conjugate(verb, :tense => :past, :aspect => :perfective)
157
+ assert_equal 'like', verb
158
+ end
147
159
  end
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
 
20
20
  s.add_development_dependency 'bueller'
21
+ s.add_development_dependency 'test-unit'
21
22
  s.add_dependency 'activesupport', '>= 2.3.4'
22
23
  s.add_dependency 'i18n'
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rossmeissl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bueller
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: test-unit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: activesupport
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -95,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.2.0
112
+ rubygems_version: 3.0.1
100
113
  signing_key:
101
114
  specification_version: 4
102
115
  summary: English verb conjugation in Ruby