latinirb 0.0.2
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/.gitignore +11 -0
- data/Gemfile +4 -0
- data/README.markdown +260 -0
- data/Rakefile +14 -0
- data/bin/latinirb +7 -0
- data/latinirb.gemspec +24 -0
- data/lib/LatinIRB.rb +172 -0
- data/lib/latinirb/paradigmatic_verbs.rb +17 -0
- data/lib/latinirb/version.rb +10 -0
- data/lib/latirb.rb +20 -0
- metadata +73 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
# LatinIRB
|
2
|
+
|
3
|
+
## DESCRIPTION
|
4
|
+
|
5
|
+
LatinIRB is an IRB session in which a user can interact with paradigmatic
|
6
|
+
Latin verbs (`@aFirst`, `@aSecond`, `@aThird`, `@aThirdIO`, `@aFourth`) as
|
7
|
+
calculated heuristically by the LatinVerb library.
|
8
|
+
|
9
|
+
The methods of chief interest will be those that are _vectors_ within the
|
10
|
+
LatinVerb parlance i.e. methods that uniquely identify a specific conjugated
|
11
|
+
form of a verb.
|
12
|
+
|
13
|
+
An primary use case would be:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
p @aFirst.active_voice_indicative_mood_present_tense_first_person_singular_number #=> amō
|
17
|
+
p @aFirst.chart #=> ( a chart )
|
18
|
+
p @aFirst.active_voice_indicative_mood_present_tense #=> ["amō", "amās", "amat", "amāmus", "amātis", "amant"]
|
19
|
+
```
|
20
|
+
|
21
|
+
Upon opening the script, the student may play with verbs offered for
|
22
|
+
exploration. These are the standard paradigmatics verbs presented in
|
23
|
+
Wheelock:
|
24
|
+
|
25
|
+
<table>
|
26
|
+
<tr><th>Varible </th> <th>Parts </th> <th> Meaning</th></tr>
|
27
|
+
<tr><td>@aFirst </td> <td>amō amāre amāvī amatum </td> <td> to love / like</td></tr>
|
28
|
+
<tr><td>@aSecond </td> <td>moneō monēre monvī monitum</td> <td> to warn / advise</td></tr>
|
29
|
+
<tr><td>@aThird </td> <td>agō agere ēgī actum </td> <td> to do / lead / undertake</td></tr>
|
30
|
+
<tr><td>@aThirdIO</td> <td>capiō capere cēpī captum </td> <td> to grab / seize</td></tr>
|
31
|
+
<tr><td>@aFourth </td> <td>audiō audīre audīvī auditum</td> <td> to hear</td></tr>
|
32
|
+
</table>
|
33
|
+
|
34
|
+
## INSTANTIATING
|
35
|
+
|
36
|
+
Because LatinVerb attempts to preserve the phonographic data of a Latin verb,
|
37
|
+
the quantity of the vowels, the LatinVerb-definining string _must_ contain the
|
38
|
+
macron data so that the heuristics work.
|
39
|
+
|
40
|
+
To this end, you may use
|
41
|
+
[MacronConversions](https://github.com/sgharms/Macronconversions) to convert
|
42
|
+
ASCII TeX-style transliterations of macronized vowels to produce the correct
|
43
|
+
string.
|
44
|
+
|
45
|
+
lv = Linguistics::Latin::Verb::LatinVerb#new("amō amāre amāvī amatum"))
|
46
|
+
lv.active\_voice\_indicative\_mood\_present\_tense\_first\_person\_singular\_number #=> amō
|
47
|
+
|
48
|
+
## VIEWING
|
49
|
+
|
50
|
+
The environment takes advantage of Ruby's UTF-8 support to display the verbs
|
51
|
+
with macrons (notation representing the quantity of the vowels). I recommend
|
52
|
+
that you use urxvt or Apple's Terminal.app for viewing these entries.
|
53
|
+
|
54
|
+
## GENERATING VERBS
|
55
|
+
|
56
|
+
Typically, in the code I have used the macron-ized character because Vim and my Terminal of choice
|
57
|
+
both understand it.
|
58
|
+
|
59
|
+
LatinVerb#new %w(amō amāre amāvī amatum)
|
60
|
+
|
61
|
+
## EXECUTING METHODS
|
62
|
+
|
63
|
+
Every verb in latin is a "vector" comprised of the voice / mood / tense /
|
64
|
+
number / and person
|
65
|
+
|
66
|
+
### CHART VIEW
|
67
|
+
|
68
|
+
To view the chart of a verb, use `LatinVerb#chart`. This is a basic chart that
|
69
|
+
will look familiar to students.
|
70
|
+
|
71
|
+
### SINGULAR VECTOR
|
72
|
+
|
73
|
+
As such methods are of the form
|
74
|
+
|
75
|
+
(active|passive)\_voice\_(indicative|subjunctive)\_mood\_(present|imperfect|perfect|pastperfect|futureperfect|etc.)tense\_first\_person\_singular\_number
|
76
|
+
|
77
|
+
This will return a single value. Where the result is ambiguous (e.g. 'number' is not provided) multiple values are returned.
|
78
|
+
an exhaustive list of options follows below.
|
79
|
+
|
80
|
+
### MULTIPLEX VECTORS
|
81
|
+
|
82
|
+
Several convenience methods exist which load multiple tenses at the same time such as "present system" or "perfect system". These
|
83
|
+
methods load the tenses into the @collections iVar associated with the LatinVerb# This value can be accessed as @collections
|
84
|
+
is shared per attr\_reader
|
85
|
+
|
86
|
+
### CHART VIEW
|
87
|
+
|
88
|
+
By using the LatinDisplay.chart\_view, a chart, much like what is found in verb references can be had for the verb. This is a
|
89
|
+
_very_ handy method.
|
90
|
+
|
91
|
+
### Comprehensive List of Singular Vectors
|
92
|
+
|
93
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_first\_person\_singular\_number
|
94
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_second\_person\_singular\_number
|
95
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_third\_person\_singular\_number
|
96
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_first\_person\_plural\_number
|
97
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_second\_person\_plural\_number
|
98
|
+
* LatinVerb#active\_voice\_indicative\_mood\_present\_tense\_third\_person\_plural\_number
|
99
|
+
|
100
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_first\_person\_singular\_number
|
101
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_second\_person\_singular\_number
|
102
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_third\_person\_singular\_number
|
103
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_first\_person\_plural\_number
|
104
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_second\_person\_plural\_number
|
105
|
+
* LatinVerb#active\_voice\_indicative\_mood\_imperfect\_tense\_third\_person\_plural\_number
|
106
|
+
|
107
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_first\_person\_singular\_number
|
108
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_second\_person\_singular\_number
|
109
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_third\_person\_singular\_number
|
110
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_first\_person\_plural\_number
|
111
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_second\_person\_plural\_number
|
112
|
+
* LatinVerb#active\_voice\_indicative\_mood\_future\_tense\_third\_person\_plural\_number
|
113
|
+
|
114
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_first\_person\_singular\_number
|
115
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_second\_person\_singular\_number
|
116
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_third\_person\_singular\_number
|
117
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_first\_person\_plural\_number
|
118
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_second\_person\_plural\_number
|
119
|
+
* LatinVerb#active\_voice\_indicative\_mood\_perfect\_tense\_third\_person\_plural\_number
|
120
|
+
|
121
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_first\_person\_singular\_number
|
122
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_second\_person\_singular\_number
|
123
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_third\_person\_singular\_number
|
124
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_first\_person\_plural\_number
|
125
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_second\_person\_plural\_number
|
126
|
+
* LatinVerb#active\_voice\_indicative\_mood\_pastperfect\_tense\_third\_person\_plural\_number
|
127
|
+
|
128
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_first\_person\_singular\_number
|
129
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_second\_person\_singular\_number
|
130
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_third\_person\_singular\_number
|
131
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_first\_person\_plural\_number
|
132
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_second\_person\_plural\_number
|
133
|
+
* LatinVerb#active\_voice\_indicative\_mood\_futureperfect\_tense\_third\_person\_plural\_number
|
134
|
+
|
135
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_first\_person\_singular\_number
|
136
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_second\_person\_singular\_number
|
137
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_third\_person\_singular\_number
|
138
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_first\_person\_plural\_number
|
139
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_second\_person\_plural\_number
|
140
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_present\_tense\_third\_person\_plural\_number
|
141
|
+
|
142
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_first\_person\_singular\_number
|
143
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_second\_person\_singular\_number
|
144
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_third\_person\_singular\_number
|
145
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_first\_person\_plural\_number
|
146
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_second\_person\_plural\_number
|
147
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_imperfect\_tense\_third\_person\_plural\_number
|
148
|
+
|
149
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_first\_person\_singular\_number
|
150
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_second\_person\_singular\_number
|
151
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_third\_person\_singular\_number
|
152
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_first\_person\_plural\_number
|
153
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_second\_person\_plural\_number
|
154
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_future\_tense\_third\_person\_plural\_number
|
155
|
+
|
156
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_first\_person\_singular\_number
|
157
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_second\_person\_singular\_number
|
158
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_third\_person\_singular\_number
|
159
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_first\_person\_plural\_number
|
160
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_second\_person\_plural\_number
|
161
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_perfect\_tense\_third\_person\_plural\_number.to\_s)
|
162
|
+
|
163
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_first\_person\_singular\_number
|
164
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_second\_person\_singular\_number
|
165
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_third\_person\_singular\_number
|
166
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_first\_person\_plural\_number
|
167
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_second\_person\_plural\_number
|
168
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_pastperfect\_tense\_third\_person\_plural\_number.to\_s)
|
169
|
+
|
170
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_first\_person\_singular\_number
|
171
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_second\_person\_singular\_number
|
172
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_third\_person\_singular\_number
|
173
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_first\_person\_plural\_number
|
174
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_second\_person\_plural\_number
|
175
|
+
* LatinVerb#passive\_voice\_indicative\_mood\_futureperfect\_tense\_third\_person\_plural\_number
|
176
|
+
|
177
|
+
|
178
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_first\_person\_singular\_number
|
179
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_second\_person\_singular\_number
|
180
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_third\_person\_singular\_number
|
181
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_first\_person\_plural\_number
|
182
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_second\_person\_plural\_number
|
183
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_present\_tense\_third\_person\_plural\_number
|
184
|
+
|
185
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_first\_person\_singular\_number
|
186
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_second\_person\_singular\_number
|
187
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_third\_person\_singular\_number
|
188
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_first\_person\_plural\_number
|
189
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_second\_person\_plural\_number
|
190
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_imperfect\_tense\_third\_person\_plural\_number
|
191
|
+
|
192
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_first\_person\_singular\_number
|
193
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_second\_person\_singular\_number
|
194
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_third\_person\_singular\_number
|
195
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_first\_person\_plural\_number
|
196
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_second\_person\_plural\_number
|
197
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_perfect\_tense\_third\_person\_plural\_number
|
198
|
+
|
199
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_first\_person\_singular\_number
|
200
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_second\_person\_singular\_number
|
201
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_third\_person\_singular\_number
|
202
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_first\_person\_plural\_number
|
203
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_second\_person\_plural\_number
|
204
|
+
* LatinVerb#active\_voice\_subjunctive\_mood\_pastperfect\_tense\_third\_person\_plural\_number
|
205
|
+
|
206
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_first\_person\_singular\_number
|
207
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_second\_person\_singular\_number
|
208
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_third\_person\_singular\_number
|
209
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_first\_person\_plural\_number
|
210
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_second\_person\_plural\_number
|
211
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_present\_tense\_third\_person\_plural\_number
|
212
|
+
|
213
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_first\_person\_singular\_number
|
214
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_second\_person\_singular\_number
|
215
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_third\_person\_singular\_number
|
216
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_first\_person\_plural\_number
|
217
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_second\_person\_plural\_number
|
218
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_imperfect\_tense\_third\_person\_plural\_number
|
219
|
+
|
220
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_first\_person\_singular\_number
|
221
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_second\_person\_singular\_number
|
222
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_third\_person\_singular\_number
|
223
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_first\_person\_plural\_number
|
224
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_second\_person\_plural\_number
|
225
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_perfect\_tense\_third\_person\_plural\_number
|
226
|
+
|
227
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_first\_person\_singular\_number
|
228
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_second\_person\_singular\_number
|
229
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_third\_person\_singular\_number
|
230
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_first\_person\_plural\_number
|
231
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_second\_person\_plural\_number
|
232
|
+
* LatinVerb#passive\_voice\_subjunctive\_mood\_pastperfect\_tense\_third\_person\_plural\_number
|
233
|
+
|
234
|
+
* LatinVerb#imperatives[0]
|
235
|
+
* LatinVerb#imperatives[1]
|
236
|
+
|
237
|
+
* LatinVerb#present\_active\_participle
|
238
|
+
* LatinVerb#future\_active\_participle
|
239
|
+
* LatinVerb#perfect\_passive\_participle
|
240
|
+
* LatinVerb#future\_passive\_participle
|
241
|
+
|
242
|
+
* LatinVerb#present\_active\_infinitive
|
243
|
+
* LatinVerb#perfect\_active\_infinitive
|
244
|
+
* LatinVerb#future\_active\_infinitive
|
245
|
+
* LatinVerb#present\_passive\_infinitive
|
246
|
+
* LatinVerb#perfect\_passive\_infinitive)
|
247
|
+
|
248
|
+
## AUTHOR
|
249
|
+
|
250
|
+
Steven G. Harms (http://stevengharms.com)
|
251
|
+
|
252
|
+
## THANKS
|
253
|
+
|
254
|
+
Thanks to the Austin Ruby coders group who answered questions that helped me put
|
255
|
+
this all together. Thanks also to the Reject^{2} conference at the Lone Star
|
256
|
+
Ruby Conference 2008 who helped me think through some of the metaprogrammatic
|
257
|
+
approaches. Thanks to Professor James Burleson of Austin Community College who
|
258
|
+
insisted, old-style, of a mastery of the rote basics of Latin. Thanks also to
|
259
|
+
Lauren Roth ( http://www.laurennroth.com) for her support and encouragement and
|
260
|
+
understanding of my pre-dawn hack sessions.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require "rake/rdoctask"
|
3
|
+
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
# Generate documentation
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.rdoc_files.include("lib/**/*.rb")
|
9
|
+
rd.rdoc_dir = "rdoc"
|
10
|
+
end
|
11
|
+
|
12
|
+
#Added to get testing working
|
13
|
+
require 'rake/testtask'
|
14
|
+
Rake::TestTask.new(:test)
|
data/bin/latinirb
ADDED
data/latinirb.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "latinirb/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "latinirb"
|
7
|
+
s.version = Linguistics::Latin::Util::LatinIRB::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Steven G. Harms"]
|
10
|
+
s.email = ["steven.harms@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/latinverb"
|
12
|
+
s.summary = %q{Gem designed to explore verbs created by LatinVerb}
|
13
|
+
s.description = %q{This gem takes initial data describing a LatinVerb and allows this is be instantiated into an IRB session. Here the verb can be queried or displayed.}
|
14
|
+
|
15
|
+
|
16
|
+
s.rubyforge_project = "latinverb"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency("latinverb",">=0.9.3")
|
24
|
+
end
|
data/lib/LatinIRB.rb
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'irb'
|
4
|
+
require 'irb/completion'
|
5
|
+
require 'latinverb'
|
6
|
+
require 'latinirb/paradigmatic_verbs'
|
7
|
+
require 'macronconversions'
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
# Monkey-patch to change the gets behavior. In the gem, the FileInputMethod
|
11
|
+
# class's 'gets' method always prints out what was read. This should be
|
12
|
+
# suppressed by the IRB class's Context class's ECHO state, but this is not
|
13
|
+
# used, possibly a bug depending on what the semantics of that @echo variable
|
14
|
+
# are meant to mean.
|
15
|
+
|
16
|
+
module IRB
|
17
|
+
class FileInputMethod < InputMethod
|
18
|
+
def gets
|
19
|
+
@io.gets
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Linguistics
|
25
|
+
module Latin
|
26
|
+
module Util
|
27
|
+
class LatinIRB
|
28
|
+
def self.begin
|
29
|
+
#---
|
30
|
+
#
|
31
|
+
# This method is taken from irb.rb's IRB.start method. I trimmed
|
32
|
+
# out some of the conditional possibilities that I did not want to
|
33
|
+
# handle here (because they're not necessary).
|
34
|
+
#
|
35
|
+
# Run the basic setup script and pull the configuration object
|
36
|
+
# (IRB::Context) back into the present scope. Then we set that
|
37
|
+
# object's options and proceed.
|
38
|
+
#
|
39
|
+
#+++
|
40
|
+
|
41
|
+
IRB.setup(nil)
|
42
|
+
@CONF = IRB.conf
|
43
|
+
|
44
|
+
# This will be the script IRB sources on execution. You can
|
45
|
+
# pre-define variables (@aFirst, etc.) and convenience methods here.
|
46
|
+
|
47
|
+
@CONF[:SCRIPT]="lib/latirb.rb"
|
48
|
+
|
49
|
+
# No, do not tell me what you read in
|
50
|
+
@CONF[:ECHO]=false
|
51
|
+
|
52
|
+
# Nor tell me how it evaluated
|
53
|
+
@CONF[:VERBOSE]=false
|
54
|
+
|
55
|
+
# We need this module
|
56
|
+
@CONF[:LOAD_MODULES]=["latinverb"]
|
57
|
+
|
58
|
+
# Create an irb object that is programmed to (silently, per above)
|
59
|
+
# source a configuration file that ends with a call to 'irb' itself
|
60
|
+
# after defining several instance variables
|
61
|
+
|
62
|
+
irb = IRB::Irb.new(nil, @CONF[:SCRIPT])
|
63
|
+
|
64
|
+
# Create a LatinIRB prompt
|
65
|
+
@CONF[:PROMPT][:LATINIRB] = {
|
66
|
+
:PROMPT_I => "LatinIRB > ",
|
67
|
+
:PROMPT_S => "LatinIRB%l> ",
|
68
|
+
:PROMPT_C => "LatinIRB > ",
|
69
|
+
:PROMPT_N => "LatinIRB ?> ",
|
70
|
+
:RETURN => " => %s \n",
|
71
|
+
:AUTO_INDENT => true
|
72
|
+
}
|
73
|
+
@CONF[:PROMPT_MODE]=:LATINIRB
|
74
|
+
|
75
|
+
# Unless this is set, eval_input will fail. Make sure this is
|
76
|
+
# set.
|
77
|
+
@CONF[:MAIN_CONTEXT] = irb.context
|
78
|
+
|
79
|
+
# This corrects the tab-completion behavior as provided by
|
80
|
+
# irb/completion.rb. In the even that what's tabbed-after matches
|
81
|
+
# the RegExp, it should invoke this process. If the receiver is a
|
82
|
+
# LatinVerb, the full complement of vectors should be provided as
|
83
|
+
# complet-able. IF NOT, then the pairing is passed to the standard
|
84
|
+
# CompletionProc.
|
85
|
+
|
86
|
+
Readline.completion_proc = calculate_completion_proc
|
87
|
+
|
88
|
+
# We have finished the configuration at this point, so now we need
|
89
|
+
# to kick up the REPL after providing preliminary instruction.
|
90
|
+
puts "Beginning a LatinVerb session."
|
91
|
+
|
92
|
+
puts "The following verbs have been made available to this session via latirb.rb:"
|
93
|
+
|
94
|
+
instance_variables.grep(/[a-z]/).each{|x| puts " * #{x}"}
|
95
|
+
|
96
|
+
puts "Tab-completion of the conjugation \"vectors\" is supported."
|
97
|
+
|
98
|
+
trap("SIGINT") do
|
99
|
+
irb.signal_handle
|
100
|
+
end
|
101
|
+
|
102
|
+
begin
|
103
|
+
catch(:IRB_EXIT) do
|
104
|
+
# Start the REPL
|
105
|
+
irb.eval_input
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
puts "Vale! Come back to LatinIRB soon."
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
#
|
114
|
+
# Used to override IRB::InputCompletor::select_message for handling
|
115
|
+
# tab-completion of instance variables. Code is largely taken from
|
116
|
+
# that method with the addition of the /^@/ condition. In
|
117
|
+
# IRB::Completor, when an array of matches has been identified, they
|
118
|
+
# are sent as the "candidates" while the "receiver" bears the match
|
119
|
+
# based on the regex of "message."
|
120
|
+
#
|
121
|
+
##
|
122
|
+
|
123
|
+
def self.select_message(receiver, message, candidates)
|
124
|
+
candidates.grep(/^#{message}/).collect do |e|
|
125
|
+
case e
|
126
|
+
when /^[a-zA-Z_]/
|
127
|
+
receiver + "." + e
|
128
|
+
when /^[0-9]/
|
129
|
+
when /^@/
|
130
|
+
e
|
131
|
+
when *Operators
|
132
|
+
#receiver + " " + e
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
#
|
139
|
+
# As part of the TAB completion, Readline must be provided a
|
140
|
+
# completion proc that will be used to generate the matching results
|
141
|
+
# that will be appended to the line at whose end the TAB key was
|
142
|
+
# struck. This method provides that proc.
|
143
|
+
#
|
144
|
+
##
|
145
|
+
|
146
|
+
def self.calculate_completion_proc
|
147
|
+
proc do |input|
|
148
|
+
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
|
149
|
+
|
150
|
+
input =~ /^([^."].*)\.([^.]*)$/
|
151
|
+
begin
|
152
|
+
receiver = $1
|
153
|
+
message = Regexp.quote($2)
|
154
|
+
rObj = instance_variable_get(receiver.to_sym)
|
155
|
+
rescue Exception
|
156
|
+
end
|
157
|
+
|
158
|
+
if rObj.class == Linguistics::Latin::Verb::LatinVerb
|
159
|
+
IRB::InputCompletor::select_message(receiver, message, rObj.instance_methods.grep(/^#{message}/))
|
160
|
+
elsif input =~ /^@/
|
161
|
+
# This handles instance variables. input is @someInstanceVariable's @aSomeIn<TAB>
|
162
|
+
self.select_message(input, input, eval("instance_variables", bind).grep(/^@a/))
|
163
|
+
else
|
164
|
+
IRB::InputCompletor::CompletionProc.call input
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'macronconversions'
|
4
|
+
|
5
|
+
module Linguistics
|
6
|
+
module Latin
|
7
|
+
module Util
|
8
|
+
class LatinIRB
|
9
|
+
@aFirst = Linguistics::Latin::Verb::LatinVerb.new %q(amō amāre amāvī amatum)
|
10
|
+
@aSecond = Linguistics::Latin::Verb::LatinVerb.new %q(moneō monēre monvī monitum)
|
11
|
+
@aThird = Linguistics::Latin::Verb::LatinVerb.new %q(agō agere ēgī actum)
|
12
|
+
@aThirdIO = Linguistics::Latin::Verb::LatinVerb.new %q(capiō capere cēpī captum)
|
13
|
+
@aFourth = Linguistics::Latin::Verb::LatinVerb.new %q(audiō audīre audīvī auditum)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/latirb.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# Basic definitions
|
3
|
+
@aFirst = Linguistics::Latin::Verb::LatinVerb.new %q(amō amāre amāvī amatum)
|
4
|
+
@aSecond = Linguistics::Latin::Verb::LatinVerb.new %q(moneō monēre monvī monitum)
|
5
|
+
@aThird = Linguistics::Latin::Verb::LatinVerb.new %q(agō agere ēgī actum)
|
6
|
+
@aThirdIO = Linguistics::Latin::Verb::LatinVerb.new %q(capiō capere cēpī captum)
|
7
|
+
@aFourth = Linguistics::Latin::Verb::LatinVerb.new %q(audiō audīre audīvī auditum)
|
8
|
+
|
9
|
+
# It's handy to have these two methods defined here for simple tests of the
|
10
|
+
# code and demonstrations.
|
11
|
+
|
12
|
+
def j
|
13
|
+
puts @aFirst.active_voice_indicative_mood_present_tense_first_person_singular_number
|
14
|
+
end
|
15
|
+
def b(f)
|
16
|
+
puts f.active_voice_indicative_mood_present_tense_first_person_singular_number
|
17
|
+
end
|
18
|
+
|
19
|
+
# Start up the REPL
|
20
|
+
irb
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: latinirb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Steven G. Harms
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: latinverb
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.3
|
30
|
+
description: This gem takes initial data describing a LatinVerb and allows this is
|
31
|
+
be instantiated into an IRB session. Here the verb can be queried or displayed.
|
32
|
+
email:
|
33
|
+
- steven.harms@gmail.com
|
34
|
+
executables:
|
35
|
+
- latinirb
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- .gitignore
|
40
|
+
- Gemfile
|
41
|
+
- README.markdown
|
42
|
+
- Rakefile
|
43
|
+
- bin/latinirb
|
44
|
+
- latinirb.gemspec
|
45
|
+
- lib/LatinIRB.rb
|
46
|
+
- lib/latinirb/paradigmatic_verbs.rb
|
47
|
+
- lib/latinirb/version.rb
|
48
|
+
- lib/latirb.rb
|
49
|
+
homepage: http://rubygems.org/gems/latinverb
|
50
|
+
licenses: []
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project: latinverb
|
69
|
+
rubygems_version: 1.8.23
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: Gem designed to explore verbs created by LatinVerb
|
73
|
+
test_files: []
|