verbs 2.0.1 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,18 +2,13 @@
2
2
 
3
3
  Conjugates most common english verbs for all persons in present and past tense (active diathesis, indicative mood). Standard and exceptional spelling rules are obeyed.
4
4
 
5
- >> Verbs::Conjugator.conjugate :be, :tense => :past, :person => :second, :plurality => :singular
5
+ >> Verbs::Conjugator.conjugate :be, :tense => :past, :person => :second, :plurality => :singular, :aspect => :perfective
6
6
  => :were
7
- >> Verbs::Conjugator.conjugate :break, :tense => :past, :person => :second, :plurality => :singular
8
- => :broke
9
- >> Verbs::Conjugator.conjugate :fly, :tense => :present, :person => :third, :plurality => :singular
10
- => :flies
11
- >> Verbs::Conjugator.conjugate :ship, :tense => :past, :person => :second, :plurality => :singular
12
- => :shipped
13
- >> Verbs::Conjugator.conjugate :hoe, :tense => :past, :person => :second, :plurality => :singular
14
- => :hoed
15
- >> Verbs::Conjugator.conjugate :coax, :tense => :present, :person => :second, :plurality => :singular
16
- => :coax
7
+ >> 'be nice'.verb.conjugate :subject => 'Matz'
8
+ => "Matz is nice"
9
+ >> :sleep.verb.conjugate :tense => :future, :person => :first, :plurality => :singular, :aspect => :progressive, :subject => true
10
+ => :"I will be sleeping"
11
+
17
12
 
18
13
  == Installation
19
14
 
@@ -21,6 +16,32 @@ The gem is hosted at http://gemcutter.org/gems/verbs
21
16
 
22
17
  gem install verbs
23
18
 
19
+ == Options
20
+
21
+ This library takes a rather strict view of English verb conjugation.
22
+
23
+ === <tt>:tense</tt>
24
+
25
+ One of <tt>:past</tt>, <tt>:present</tt>, or <tt>:future</tt>. Defaults to <tt>:present</tt>.
26
+
27
+ === <tt>:person</tt>
28
+
29
+ One of <tt>:first</tt>, <tt>:second</tt>, or <tt>:third</tt>. Defaults to <tt>:third</tt>.
30
+
31
+ === <tt>:plurality</tt>
32
+
33
+ Either <tt>:singular</tt> or <tt>:plural</tt>. Defaults to <tt>:singular</tt>.
34
+
35
+ === <tt>:aspect</tt>
36
+
37
+ One of <tt>:habitual</tt>, <tt>:perfect</tt>, <tt>:perfective</tt>, <tt>:progressive</tt>, or <tt>:prospective</tt>. Defaults to <tt>:habitual</tt>.
38
+
39
+ See below for a guide to verb aspect.
40
+
41
+ === <tt>:subject</tt>
42
+
43
+ Set this to a string to prepend the conjugated verb with it. When set to <tt>true</tt>, a standard personal pronoun will be used.
44
+
24
45
  == Tense/aspect quick reference
25
46
 
26
47
  EXAMPLE TENSE ASPECT
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.3
@@ -46,7 +46,8 @@ module Verbs
46
46
 
47
47
  conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality }.join(' ').strip
48
48
 
49
- if actor = options.delete(:subject)
49
+ if options[:subject]
50
+ actor = options.delete(:subject)
50
51
  actor = subject(options).humanize if actor.is_a?(TrueClass)
51
52
  end
52
53
 
@@ -106,8 +107,8 @@ module Verbs
106
107
  end
107
108
 
108
109
  def present_participle(infinitive)
109
- if infinitive.to_s.match(/#{VOWEL_PATTERN}#{CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(infinitive)
110
- present_participle_with_doubled_terminal_consonant_for verb
110
+ if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(infinitive)
111
+ present_participle_with_doubled_terminal_consonant_for infinitive
111
112
  elsif infinitive.to_s.match(/c$/)
112
113
  infinitive.to_s.concat('king').to_sym
113
114
  elsif infinitive.to_s.match(/ye$/) or infinitive.to_s.match(/oe$/) or infinitive.to_s.match(/nge$/) or infinitive.to_s.match(/ee$/)
data/test/test_verbs.rb CHANGED
@@ -70,6 +70,9 @@ class TestVerbs < Test::Unit::TestCase
70
70
  assert_equal 'Matz is', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :plurality => :singular, :subject => 'Matz', :aspect => :habitual)
71
71
  assert_equal 'We are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :first, :plurality => :plural, :subject => true, :aspect => :habitual)
72
72
  end
73
+ def test_conjugation_with_false_subject
74
+ assert_equal 'accepts', Verbs::Conjugator.conjugate(:accept, :subject => false)
75
+ end
73
76
  def test_core_access
74
77
  assert_equal :accepts, :accept.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
75
78
  assert_equal 'accepts', 'accept'.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
data/verbs.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{verbs}
8
- s.version = "2.0.1"
8
+ s.version = "2.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Rossmeissl"]
12
- s.date = %q{2009-12-09}
12
+ s.date = %q{2009-12-10}
13
13
  s.description = %q{Conjugates most common english verbs for all persons in present and past tense (active diathesis, indicative mood). Standard and exceptional spelling rules are obeyed.}
14
14
  s.email = %q{andy@rossmeissl.net}
15
15
  s.extra_rdoc_files = [
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.0.1
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rossmeissl
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-09 00:00:00 -05:00
12
+ date: 2009-12-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15