intar 2.10 → 2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +3 -1
- data/lib/intar/redirect.rb +1 -1
- data/lib/intar/version.rb +1 -1
- data/lib/intar.rb +22 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0b8c82a2fd61d3a7fe7be7078c4cf96b37dabd18c00c25ad84a51cb34d06445
|
4
|
+
data.tar.gz: c8045ce6959c1fda974eec564229bbe95b2adf2acd9470c650863f4e405f7adf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a6d77c597107d260b723a107feae4049a31c81654b420169ef4ec6db55eaa1e23e47f9357f74b9d80308439acfb39da6d14c3d68a09be992d3636b99caf1ca
|
7
|
+
data.tar.gz: 950d148dc9e33d4d840c3d9187de1db39ebc0b2cabc046f334c8474202f180b4db9e0a65e8f9086f7856f3a858cc5fafae11ffe7f4788a0f77bdef9385ee0d0d
|
data/README
CHANGED
@@ -12,7 +12,8 @@ inside an application and so on.
|
|
12
12
|
|
13
13
|
Today, Intar is a tool far less complex than Irb.
|
14
14
|
|
15
|
-
Yet, Intar is more robust.
|
15
|
+
Yet, Intar is more robust. Have a look at what happens
|
16
|
+
after this in Irb and in Intar:
|
16
17
|
|
17
18
|
prompt> Thread.new { sleep 3 ; Thread.main.raise "stop" }
|
18
19
|
|
@@ -24,6 +25,7 @@ Yet, Intar is more robust. Try this in Irb and in Intar:
|
|
24
25
|
|
25
26
|
obj.method & enter a sub-Intar
|
26
27
|
obj.each & enter multiple sub-Intars
|
28
|
+
obj.method &x enter a sub-Intar with variable x
|
27
29
|
|
28
30
|
\q exit from the innermost sub-Intar
|
29
31
|
\q! exit from the innermost sub-Intar loop
|
data/lib/intar/redirect.rb
CHANGED
data/lib/intar/version.rb
CHANGED
data/lib/intar.rb
CHANGED
@@ -76,21 +76,21 @@ class Intar
|
|
76
76
|
|
77
77
|
@@current = nil
|
78
78
|
|
79
|
-
attr_reader :params, :prompt, :depth, :n
|
79
|
+
attr_reader :params, :prompt, :depth, :n, :binding
|
80
80
|
def initialize obj = nil, **params
|
81
81
|
@obj = obj.nil? ? (eval "self", TOPLEVEL_BINDING) : obj
|
82
82
|
if @@current then
|
83
|
-
@params
|
84
|
-
@prompt
|
85
|
-
@depth
|
83
|
+
@params = @@current.params
|
84
|
+
@prompt = @@current.prompt
|
85
|
+
@depth = @@current.depth + 1
|
86
|
+
@binding = @@current.binding
|
86
87
|
else
|
87
88
|
@params = DEFAULTS.dup.update params
|
88
89
|
@prompt = Prompt.new
|
89
90
|
@depth = 0
|
91
|
+
@binding = @obj.intar_binding
|
90
92
|
end
|
91
93
|
@n = 1
|
92
|
-
|
93
|
-
@binding = @obj.intar_binding
|
94
94
|
end
|
95
95
|
|
96
96
|
|
@@ -146,11 +146,26 @@ class Intar
|
|
146
146
|
eval code, @binding, "#{self.class}/execute"
|
147
147
|
end
|
148
148
|
|
149
|
+
def set_var name, val
|
150
|
+
@binding.local_variable_set name, val
|
151
|
+
end
|
152
|
+
|
149
153
|
|
150
154
|
private
|
151
155
|
|
152
156
|
def eval_line l
|
153
|
-
ls = l.sub %r/\s
|
157
|
+
ls = l.sub %r/\s+&(\w+)?\s*\z/ do
|
158
|
+
<<~EOT
|
159
|
+
\ do |obj|
|
160
|
+
Intar.open #{"obj " unless $1}do |i|
|
161
|
+
#{"# " unless $1}i.set_var "#$1", obj
|
162
|
+
i.run
|
163
|
+
end
|
164
|
+
rescue Intar::Break
|
165
|
+
break
|
166
|
+
end
|
167
|
+
EOT
|
168
|
+
end
|
154
169
|
@redir.redirect_output do eval ls, @binding, @file end
|
155
170
|
end
|
156
171
|
|
@@ -181,14 +196,6 @@ class Intar
|
|
181
196
|
end
|
182
197
|
|
183
198
|
|
184
|
-
SUB = <<~EOT
|
185
|
-
\ do |obj|
|
186
|
-
Intar.run obj
|
187
|
-
rescue Intar::Break
|
188
|
-
break
|
189
|
-
end
|
190
|
-
EOT
|
191
|
-
|
192
199
|
OLDSET = <<~EOT
|
193
200
|
_, __, ___ = nil, nil, nil
|
194
201
|
proc { |r,n|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appl
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements:
|
76
76
|
- Ruby and some small Gems; Readline
|
77
|
-
rubygems_version: 3.4.
|
77
|
+
rubygems_version: 3.4.20
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Interactive Ruby
|