hablaba 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/hablaba.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999cfb467e3b8d4b9d44c9c53c62819da12a30fc
|
4
|
+
data.tar.gz: 22c009cbffaffbb934cbfb11348e46edd1946abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8430685d0b27034bf1ebec4e16e6b63d27e3a89eaaa941eafcc2aa8c3422d6118c662892a923313859b52efc0160d7462ac172bd3016d814f6a0b932b02976fd
|
7
|
+
data.tar.gz: 2875b7213bd3b72da1189800b293f6012fda3c935461b2c02f3108b9e1cd6df27e90ef6d18ed1b534dfdc36df42304faefce4d440462a4445296bf5bf56819c6
|
data/lib/hablaba.rb
CHANGED
@@ -25,6 +25,14 @@ class Hablaba
|
|
25
25
|
conjugate_in_the_preterite(pronoun, verb)
|
26
26
|
when :imperfect
|
27
27
|
conjugate_in_the_imperfect(pronoun, verb)
|
28
|
+
when :present_subjunctive
|
29
|
+
conjugate_in_the_present_subjunctive(pronoun, verb)
|
30
|
+
when :imperfect_subjunctive
|
31
|
+
conjugate_in_the_imperfect_subjunctive(pronoun, verb)
|
32
|
+
when :conditional
|
33
|
+
conjugate_in_the_conditional(pronoun, verb)
|
34
|
+
when :future
|
35
|
+
conjugate_in_the_future(pronoun, verb)
|
28
36
|
else
|
29
37
|
# TODO: raise error
|
30
38
|
end
|
@@ -101,6 +109,33 @@ class Hablaba
|
|
101
109
|
root_of_verb + %W[ía ías ía íamos íais ían][pronoun_index(pronoun)]
|
102
110
|
end
|
103
111
|
|
112
|
+
# normally you would actually need to start by getting the verb in the first-person
|
113
|
+
# present, but since this only handles regular verbs, this is easy enough to handle
|
114
|
+
# with this method
|
115
|
+
def conjugate_in_the_present_subjunctive(pronoun, verb)
|
116
|
+
verb_ending, root = get_verb_ending_and_root(verb)
|
117
|
+
if verb_ending == 'ar'
|
118
|
+
root + %W[e es e emos éis en][pronoun_index(pronoun)]
|
119
|
+
else # er and ir are the same
|
120
|
+
root + %W[a as a amos áis an][pronoun_index(pronoun)]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def conjugate_in_the_imperfect_subjunctive(pronoun, verb)
|
125
|
+
verb_ending, root = get_verb_ending_and_root(verb)
|
126
|
+
# get the third person preterite
|
127
|
+
third_person_root = conjugate_in_the_preterite('ellos', verb).gsub(/on\z|an\z/i, '')
|
128
|
+
third_person_root + %W[a as a amos ais an][pronoun_index(pronoun)]
|
129
|
+
end
|
130
|
+
|
131
|
+
def conjugate_in_the_conditional(pronoun, verb)
|
132
|
+
verb + %W[ía ías ía íamos íais ían][pronoun_index(pronoun)]
|
133
|
+
end
|
134
|
+
|
135
|
+
def conjugate_in_the_future(pronoun, verb)
|
136
|
+
verb + %W[é ás á emos éis án][pronoun_index(pronoun)]
|
137
|
+
end
|
138
|
+
|
104
139
|
end
|
105
140
|
|
106
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hablaba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Duyzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Hablaba conjugates regular Spanish verbs in multiple tenses
|
14
14
|
email: adrianduyzer@gmail.com
|