intar 2.15 → 2.16.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README +9 -7
  3. data/lib/intar/version.rb +1 -1
  4. data/lib/intar.rb +29 -11
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33d3b8a846784d28dd22d4d7b2bc8ae58885e80581457b5de57974db4bb86967
4
- data.tar.gz: 7ce97b2ca8e36d0eb8ba68ce289c36e9de94f7a479c6b4ed24f6529030d621a9
3
+ metadata.gz: 65941b687800d76ae7bba2e690b56ba94f30ca1ccd78650db345a0fb8cc60891
4
+ data.tar.gz: 231b81799431f3a33b00139f57b3c83f42a261238d1c46342a349fafbfea3e68
5
5
  SHA512:
6
- metadata.gz: ba549858060a566243199d3404a5231e1496ace0fd5f2ffa0336d55b4bf528a355ea78c0294de80027bf243a4d0c0f4c25159caa942f0d9db1fae1a2b10bce22
7
- data.tar.gz: 827d0d193fcdf092e3b5c79b0e67dca0763e1ee46f34cd70f70a0921d117729191017895219eaf2ce93a5e0a2144172f2bbcaeff221314b45a1dd7ae2856b4bf
6
+ metadata.gz: 9c2732ba6af248d47aeb7d29ee98de5ae78c4cec84ba20865c15740ac6b0d9b1b688d05a1f72d34c44874267d7ac0477980707a29840280721b425729d30b3c5
7
+ data.tar.gz: '0285277cabae513ff717d452f8017c7dfade0e80c3c7648633c066cbeca70b4d695bd73e1230f8f3aaaa83211bcb632a6cd64906c803a09b30a48c01097b2a5f'
data/README CHANGED
@@ -23,15 +23,17 @@ after this in Irb and in Intar:
23
23
 
24
24
  === Subcommands
25
25
 
26
- obj.method +> enter a sub-Intar
27
- obj.each +> enter multiple sub-Intars
28
- obj.method +>x enter a sub-Intar with variable x
26
+ obj.method do & enter a sub-Intar
27
+ obj.method { & enter a sub-Intar
28
+ obj.each { & enter multiple sub-Intars
29
+ obj.method { |x| & enter a sub-Intar with variable x
30
+ obj.method { |x,y| & enter a sub-Intar with multiple variables
29
31
 
30
- \q exit from the innermost sub-Intar
31
- \q! exit from the innermost sub-Intar loop
32
- \q!! exit from all levels
32
+ \q exit from the innermost sub-Intar
33
+ \q! exit from the innermost sub-Intar loop
34
+ \q!! exit from all levels
33
35
 
34
- \h get a list of all subcommands
36
+ \h get a list of all subcommands
35
37
 
36
38
 
37
39
 
data/lib/intar/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  class Intar
6
6
 
7
- VERSION = "2.15".freeze
7
+ VERSION = "2.16.1".freeze
8
8
 
9
9
  end
10
10
 
data/lib/intar.rb CHANGED
@@ -116,6 +116,7 @@ class Intar
116
116
  handle_history do
117
117
  set_current do
118
118
  execute OLD_INIT
119
+ r = nil
119
120
  loop do
120
121
  l = readline
121
122
  l or break
@@ -150,6 +151,7 @@ class Intar
150
151
  (execute OLD_SET).call r, @n
151
152
  @n += 1
152
153
  end
154
+ r
153
155
  ensure
154
156
  execute OLD_INIT
155
157
  end
@@ -168,19 +170,35 @@ class Intar
168
170
  private
169
171
 
170
172
  def eval_line l
171
- ls = l.sub %r/\s+\+>(\w+)?\s*\z/ do
172
- <<~EOT
173
- \ do |obj|
174
- Intar.open #{$1 ? "self" : "obj"} do |i|
175
- #{"# " unless $1}i.set_var "#$1", obj
176
- i.run
177
- end
178
- rescue Intar::Break
179
- break
173
+ if l =~ %r/\s*(?:\{|\bdo)\s*(?:\|([a-z0-9_,]*)\|)?\s*&\z/ then
174
+ cmd = $`
175
+ argl = $1
176
+ if argl.notempty? then
177
+ s = (argl.split ",").map { |a|
178
+ break unless a =~ /\A[a-z][a-z0-9_]*\z/
179
+ %Q((_i.set_var "#{a}", #{a}))
180
+ }
181
+ if s then
182
+ sets = s.join "; "
183
+ iobj = "self"
180
184
  end
181
- EOT
185
+ else
186
+ argl = iobj = "obj"
187
+ end
188
+ if iobj then
189
+ l = cmd + <<~EOT
190
+ \ do |#{argl}|
191
+ Intar.open #{iobj} do |_i|
192
+ #{sets}
193
+ _i.run
194
+ end
195
+ rescue Intar::Break
196
+ break
197
+ end
198
+ EOT
199
+ end
182
200
  end
183
- @redir.redirect_output do execute ls end
201
+ @redir.redirect_output do execute l end
184
202
  end
185
203
 
186
204
  def handle_history
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.15'
4
+ version: 2.16.1
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-11-19 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appl
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements:
90
90
  - Ruby and some small Gems; Readline
91
- rubygems_version: 3.4.20
91
+ rubygems_version: 3.4.22
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Interactive Ruby