latinirb 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +5 -11
- data/lib/LatinIRB.rb +48 -133
- data/lib/latinirb/version.rb +1 -1
- data/lib/latirb.rb +1 -4
- metadata +9 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c57bbd86b3d1dd4c0c91df4d40df713380ef70be
|
4
|
+
data.tar.gz: 1a9145e1b89143f1a093bcfc4b192d6738b30e41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb77e235b525e3ee59ffcae5effac435b4776fb9472c3cc05974201fe997cbd80e47e611fe7d81c5e4f8e2fdeff68ca7a58752db2cdb590486db46d296e9699f
|
7
|
+
data.tar.gz: 7a9a02f0eb9634e8a94e9f8ca02501c7b86b95173fb1af94f80c44aa4113e9eb6962c2a9399a118ac963110a55f31cf80e86c2ad5aa6d40d392a8060ceb0bcd2
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
latinirb (0.3.
|
4
|
+
latinirb (0.3.4)
|
5
5
|
activesupport (>= 4)
|
6
|
-
latinverb (~> 0.9.
|
6
|
+
latinverb (~> 0.9.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
@@ -15,14 +15,9 @@ GEM
|
|
15
15
|
thread_safe (~> 0.1)
|
16
16
|
tzinfo (~> 0.3.37)
|
17
17
|
atomic (1.1.14)
|
18
|
-
byebug (2.2.2)
|
19
|
-
columnize (~> 0.3.6)
|
20
|
-
debugger-linecache (~> 1.2.0)
|
21
|
-
columnize (0.3.6)
|
22
|
-
debugger-linecache (1.2.0)
|
23
18
|
i18n (0.6.5)
|
24
|
-
json (1.8.
|
25
|
-
latinverb (0.9.
|
19
|
+
json (1.8.0)
|
20
|
+
latinverb (0.9.5)
|
26
21
|
activesupport
|
27
22
|
linguistics_latin
|
28
23
|
macronconversions
|
@@ -30,7 +25,7 @@ GEM
|
|
30
25
|
rdoc
|
31
26
|
linguistics_latin (0.0.1)
|
32
27
|
macronconversions (0.0.1)
|
33
|
-
minitest (4.
|
28
|
+
minitest (4.3.2)
|
34
29
|
multi_json (1.8.2)
|
35
30
|
rake (10.1.0)
|
36
31
|
rdoc (4.0.1)
|
@@ -43,5 +38,4 @@ PLATFORMS
|
|
43
38
|
ruby
|
44
39
|
|
45
40
|
DEPENDENCIES
|
46
|
-
byebug
|
47
41
|
latinirb!
|
data/lib/LatinIRB.rb
CHANGED
@@ -4,60 +4,32 @@ require 'irb'
|
|
4
4
|
require 'irb/completion'
|
5
5
|
require 'latinverb'
|
6
6
|
|
7
|
-
# Monkey-patch to change the gets behavior. In the gem, the FileInputMethod
|
8
|
-
# class's 'gets' method always prints out what was read. This should be
|
9
|
-
# suppressed by the IRB class's Context class's ECHO state, but this is not
|
10
|
-
# used, possibly a bug depending on what the semantics of that @echo variable
|
11
|
-
# are meant to mean.
|
12
|
-
|
13
|
-
module IRB
|
14
|
-
class FileInputMethod < InputMethod
|
15
|
-
def gets
|
16
|
-
@io.gets
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
7
|
module Linguistics
|
22
8
|
module Latin
|
23
9
|
module Util
|
24
10
|
class LatinIRB
|
25
11
|
def self.begin
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
# Run the basic setup script and pull the configuration object
|
33
|
-
# (IRB::Context) back into the present scope. Then we set that
|
34
|
-
# object's options and proceed.
|
35
|
-
#
|
36
|
-
#+++
|
12
|
+
configure_irb_singleton
|
13
|
+
@irb = get_irb_singleton
|
14
|
+
set_required_main_irb_context
|
15
|
+
configure_latinverb_prompt
|
16
|
+
print_prelude
|
37
17
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# This will be the script IRB sources on execution. You can
|
42
|
-
# pre-define variables (@aFirst, etc.) and convenience methods here.
|
43
|
-
|
44
|
-
@CONF[:SCRIPT]=File.join(File.dirname(__FILE__), %w|latirb.rb|)
|
45
|
-
|
46
|
-
# No, do not tell me what you read in
|
47
|
-
@CONF[:ECHO]=false
|
48
|
-
|
49
|
-
# Nor tell me how it evaluated
|
50
|
-
@CONF[:VERBOSE]=false
|
51
|
-
|
52
|
-
# We need this module
|
53
|
-
@CONF[:LOAD_MODULES]=["latinverb"]
|
18
|
+
trap("SIGINT") do
|
19
|
+
irb.signal_handle
|
20
|
+
end
|
54
21
|
|
55
|
-
|
56
|
-
|
57
|
-
|
22
|
+
begin
|
23
|
+
catch(:IRB_EXIT) do
|
24
|
+
# Start the REPL
|
25
|
+
@irb.eval_input
|
26
|
+
end
|
27
|
+
end
|
58
28
|
|
59
|
-
|
29
|
+
puts "Vale! Come back to LatinIRB soon."
|
30
|
+
end
|
60
31
|
|
32
|
+
def self.configure_latinverb_prompt
|
61
33
|
# Create a LatinIRB prompt
|
62
34
|
@CONF[:PROMPT][:LATINIRB] = {
|
63
35
|
:PROMPT_I => "LatinIRB > ",
|
@@ -68,109 +40,52 @@ module Linguistics
|
|
68
40
|
:AUTO_INDENT => true
|
69
41
|
}
|
70
42
|
@CONF[:PROMPT_MODE]=:LATINIRB
|
43
|
+
end
|
71
44
|
|
72
|
-
|
73
|
-
|
74
|
-
@CONF
|
45
|
+
def self.configure_irb_singleton
|
46
|
+
IRB.setup(nil)
|
47
|
+
@CONF = IRB.conf
|
75
48
|
|
76
|
-
# This
|
77
|
-
#
|
78
|
-
# the RegExp, it should invoke this process. If the receiver is a
|
79
|
-
# LatinVerb, the full complement of vectors should be provided as
|
80
|
-
# complet-able. IF NOT, then the pairing is passed to the standard
|
81
|
-
# CompletionProc.
|
49
|
+
# This will be the script IRB sources on execution. You can
|
50
|
+
# pre-define variables (@aFirst, etc.) and convenience methods here.
|
82
51
|
|
83
|
-
|
52
|
+
@CONF[:SCRIPT]=File.join(File.dirname(__FILE__), %w|latirb.rb|)
|
84
53
|
|
85
|
-
#
|
86
|
-
|
87
|
-
puts "Beginning a LatinVerb session."
|
54
|
+
# No, do not tell me what you read in
|
55
|
+
@CONF[:ECHO]=false
|
88
56
|
|
89
|
-
|
57
|
+
# Nor tell me how it evaluated
|
58
|
+
@CONF[:VERBOSE]=false
|
59
|
+
end
|
90
60
|
|
91
|
-
|
92
|
-
#
|
93
|
-
|
94
|
-
|
95
|
-
x.sub(/(@\w+)\s.*\n/, "\\1")
|
96
|
-
end
|
97
|
-
@irb_ivars.each{|x| puts " * #{x}\n"}
|
61
|
+
def self.get_irb_singleton
|
62
|
+
# Create an irb object that is programmed to source a configuration
|
63
|
+
# file that ends with a call to 'irb' itself after defining several
|
64
|
+
# instance variables
|
98
65
|
|
66
|
+
@CONF[:LOAD_MODULES]=["latinverb"]
|
67
|
+
IRB::Irb.new(nil, @CONF[:SCRIPT])
|
68
|
+
end
|
99
69
|
|
70
|
+
def self.print_prelude
|
71
|
+
puts "Beginning a LatinVerb session."
|
72
|
+
puts "The following verbs have been made available to this session:"
|
73
|
+
self.irb_ivars.each{|x| puts " * #{x}"}
|
100
74
|
puts "Tab-completion of the conjugation \"vectors\" is supported."
|
101
|
-
|
102
|
-
trap("SIGINT") do
|
103
|
-
irb.signal_handle
|
104
|
-
end
|
105
|
-
|
106
|
-
begin
|
107
|
-
catch(:IRB_EXIT) do
|
108
|
-
# Start the REPL
|
109
|
-
irb.eval_input
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
puts "Vale! Come back to LatinIRB soon."
|
75
|
+
puts ""
|
114
76
|
end
|
115
77
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
# tab-completion of instance variables. Code is largely taken from
|
120
|
-
# that method with the addition of the /^@/ condition. In
|
121
|
-
# IRB::Completor, when an array of matches has been identified, they
|
122
|
-
# are sent as the "candidates" while the "receiver" bears the match
|
123
|
-
# based on the regex of "message."
|
124
|
-
#
|
125
|
-
##
|
126
|
-
|
127
|
-
def self.select_message(receiver, message, candidates)
|
128
|
-
candidates.grep(/^#{message}/).collect do |e|
|
129
|
-
case e
|
130
|
-
when /^[a-zA-Z_]/
|
131
|
-
receiver + "." + e
|
132
|
-
when /^[0-9]/
|
133
|
-
when /^@/
|
134
|
-
e
|
135
|
-
when *Operators
|
136
|
-
#receiver + " " + e
|
137
|
-
end
|
78
|
+
def self.irb_ivars
|
79
|
+
File::open(@irb.context.io.file_name).readlines.grep(/^@/).map do |x|
|
80
|
+
x.sub(/(@\w+)\s.*\n/, "\\1")
|
138
81
|
end
|
139
82
|
end
|
140
83
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
# completion proc that will be used to generate the matching results
|
145
|
-
# that will be appended to the line at whose end the TAB key was
|
146
|
-
# struck. This method provides that proc.
|
147
|
-
#
|
148
|
-
##
|
149
|
-
|
150
|
-
def self.calculate_completion_proc
|
151
|
-
proc do |input|
|
152
|
-
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding
|
153
|
-
|
154
|
-
input =~ /^([^."].*)\.([^.]*)$/
|
155
|
-
begin
|
156
|
-
receiver = $1
|
157
|
-
message = Regexp.quote($2)
|
158
|
-
|
159
|
-
# Pull the object from the binding
|
160
|
-
rObj = eval("instance_variable_get(:#{receiver})", bind)
|
161
|
-
rescue Exception
|
162
|
-
end
|
163
|
-
|
164
|
-
if rObj.class == Linguistics::Latin::Verb::LatinVerb
|
165
|
-
IRB::InputCompletor::select_message(receiver, message, rObj.instance_methods.grep(/^#{message}/))
|
166
|
-
elsif input =~ /^@/
|
167
|
-
# This handles instance variables. input is @someInstanceVariable's @aSomeIn<TAB>
|
168
|
-
self.select_message input, input, eval("instance_variables", bind).grep(/@[at]/)
|
169
|
-
else
|
170
|
-
IRB::InputCompletor::CompletionProc.call input
|
171
|
-
end
|
172
|
-
end
|
84
|
+
def self.set_required_main_irb_context
|
85
|
+
# Unless this is set, eval_input will fail.
|
86
|
+
@CONF[:MAIN_CONTEXT] = @irb.context
|
173
87
|
end
|
88
|
+
|
174
89
|
end
|
175
90
|
end
|
176
91
|
end
|
data/lib/latinirb/version.rb
CHANGED
data/lib/latirb.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# Basic definitions
|
3
2
|
@aFirst = Linguistics::Latin::Verb::LatinVerb.new %q(amō amāre amāvī amatum)
|
4
3
|
@aSecond = Linguistics::Latin::Verb::LatinVerb.new %q(moneō monēre monvī monitum)
|
@@ -11,12 +10,10 @@
|
|
11
10
|
@toCarry = Linguistics::Latin::Verb::LatinVerb.new %q(ferō ferre tulī lātum)
|
12
11
|
@toCome = Linguistics::Latin::Verb::LatinVerb.new %q(eō īre ivī itum)
|
13
12
|
|
14
|
-
# It's handy to have these two methods defined here for simple tests of the
|
15
|
-
# code and demonstrations.
|
16
|
-
|
17
13
|
def j
|
18
14
|
puts @aFirst.active_voice_indicative_mood_present_tense_first_person_singular_number
|
19
15
|
end
|
16
|
+
|
20
17
|
def b(f)
|
21
18
|
puts f.active_voice_indicative_mood_present_tense_first_person_singular_number
|
22
19
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latinirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steven G. Harms
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: latinverb
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,17 +27,15 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activesupport
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '4'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '4'
|
46
41
|
description: This gem takes initial data describing a LatinVerb and allows this is
|
@@ -64,26 +59,25 @@ files:
|
|
64
59
|
- lib/latirb.rb
|
65
60
|
homepage: http://rubygems.org/gems/latinverb
|
66
61
|
licenses: []
|
62
|
+
metadata: {}
|
67
63
|
post_install_message:
|
68
64
|
rdoc_options: []
|
69
65
|
require_paths:
|
70
66
|
- lib
|
71
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
68
|
requirements:
|
74
|
-
- -
|
69
|
+
- - '>='
|
75
70
|
- !ruby/object:Gem::Version
|
76
71
|
version: '0'
|
77
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
73
|
requirements:
|
80
|
-
- -
|
74
|
+
- - '>='
|
81
75
|
- !ruby/object:Gem::Version
|
82
76
|
version: '0'
|
83
77
|
requirements: []
|
84
78
|
rubyforge_project:
|
85
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.0.3
|
86
80
|
signing_key:
|
87
|
-
specification_version:
|
81
|
+
specification_version: 4
|
88
82
|
summary: Gem designed to explore verbs created by LatinVerb
|
89
83
|
test_files: []
|