verbs 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/verbs.rb +1 -0
- data/lib/verbs/verblike.rb +32 -0
- data/test/test_verbs.rb +4 -0
- data/verbs.gemspec +2 -1
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/verbs.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Verbs
|
2
|
+
module Verblike
|
3
|
+
class Wrapper
|
4
|
+
def initialize(base)
|
5
|
+
@base = base
|
6
|
+
end
|
7
|
+
|
8
|
+
def conjugate(options)
|
9
|
+
words = @base.to_s.split(' ')
|
10
|
+
words.shift if words.first.downcase == 'to'
|
11
|
+
infinitive = words.shift.to_sym
|
12
|
+
conjugation = ::Verbs::Conjugator.conjugate infinitive, options
|
13
|
+
conjugated = words.unshift(conjugation.to_s).join(' ')
|
14
|
+
@base.is_a?(Symbol) ? conjugated.to_sym : conjugated
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Access
|
19
|
+
def verb
|
20
|
+
::Verbs::Verblike::Wrapper.new self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class String
|
27
|
+
include ::Verbs::Verblike::Access
|
28
|
+
end
|
29
|
+
|
30
|
+
class Symbol
|
31
|
+
include ::Verbs::Verblike::Access
|
32
|
+
end
|
data/test/test_verbs.rb
CHANGED
@@ -82,4 +82,8 @@ class TestVerbs < Test::Unit::TestCase
|
|
82
82
|
assert_equal 'Matz is', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :plurality => :singular, :subject => 'Matz')
|
83
83
|
assert_equal 'We are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :first, :plurality => :plural, :subject => true)
|
84
84
|
end
|
85
|
+
def test_core_access
|
86
|
+
assert_equal :accepts, :accept.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular)
|
87
|
+
assert_equal 'accepts', 'accept'.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular)
|
88
|
+
end
|
85
89
|
end
|
data/verbs.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{verbs}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
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"]
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/verbs/conjugations.rb",
|
28
28
|
"lib/verbs/conjugator.rb",
|
29
29
|
"lib/verbs/verb.rb",
|
30
|
+
"lib/verbs/verblike.rb",
|
30
31
|
"test/helper.rb",
|
31
32
|
"test/test_verbs.rb",
|
32
33
|
"verbs.gemspec"
|
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Rossmeissl
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- lib/verbs/conjugations.rb
|
34
34
|
- lib/verbs/conjugator.rb
|
35
35
|
- lib/verbs/verb.rb
|
36
|
+
- lib/verbs/verblike.rb
|
36
37
|
- test/helper.rb
|
37
38
|
- test/test_verbs.rb
|
38
39
|
- verbs.gemspec
|