intar 2.17 → 2.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca657e64327a8cda404e8a260ac85366046890fe21a903388d0aabbfda83e499
4
- data.tar.gz: ccd323d0095cbd53b704e7a33a3cb40431f7b585be513cb4256fd0954a5b4f3c
3
+ metadata.gz: 2906a0c6492a351a047ba1b17fd008648b4b696c3d6725f1690cc955c73d4b6c
4
+ data.tar.gz: 9f97fe2061b9db44f37976c06980c6d998391d5d1f109aa436bb20e015a7433e
5
5
  SHA512:
6
- metadata.gz: 42ed716101d67d08b4583984a2ebcbdfc1a6ad476c6a6237b05a5753b71ee65e58e33d15f93d48f1c70c328b5716783e59eb27a520b6370ba863312227c0c178
7
- data.tar.gz: ea00d84c6b4c0a8f79d40ec5d1495b27d5becaac9859175572d0af13a70efe0a487c7068551f330393db915fddc83b3ac23baacd22aa1ece2ecb9eb383f5548c
6
+ metadata.gz: 2de63df77c02db472de032a591fd4e6ab8c220660726b9e0769ed56bdb9edfe4934602c255c707ea181ca884adf041e2b051551f1ce731d3fb8d3696a780180b
7
+ data.tar.gz: 1134b8d8054c279a861ce9f1ad28c62002ebcc6d8ade642723798e1c1e107480a4e4844f01fc0f75613d077e22224f05c27d67770ca127dd92f3935912fa1fe9
@@ -0,0 +1,15 @@
1
+ #
2
+ # intar/foreign/supplement/socket.rb -- Addition usefull Ruby socket functions
3
+ #
4
+
5
+ # The purpose of this is simply to reduce dependencies.
6
+
7
+ begin
8
+ require "supplement/terminal"
9
+ rescue LoadError
10
+ require "io/console"
11
+ class IO
12
+ def wingeom ; winsize.reverse ; end
13
+ end
14
+ end
15
+
@@ -0,0 +1,64 @@
1
+ #
2
+ # intar/foreign/supplement.rb -- Additional useful Ruby functions
3
+ #
4
+
5
+ # The purpose of this is simply to reduce dependencies.
6
+
7
+ begin
8
+ require "supplement"
9
+ rescue LoadError
10
+ class NilClass ; def nonzero? ; end ; end
11
+ class NilClass ; def notempty? ; end ; end
12
+ class String ; def notempty? ; self unless empty? ; end ; end
13
+ class Array ; def notempty? ; self unless empty? ; end ; end
14
+ class Array ; def first= val ; self[ 0] = val ; end ; end
15
+ class Array ; def last= val ; self[-1] = val ;
16
+ rescue IndexError ; a.push val ; end ; end
17
+ class NilClass ; def to_bool ; false ; end ; end
18
+ class FalseClass ; def to_bool ; false ; end ; end
19
+ class Object ; def to_bool ; true ; end ; end
20
+ class <<Struct ; alias [] new ; end
21
+ class Module
22
+ def plain_name
23
+ sep = "::"
24
+ n = name.dup
25
+ i = n.rindex sep
26
+ n.slice! 0, i+sep.length if i
27
+ n
28
+ end
29
+ end
30
+ class String
31
+ ELLIPSE = :"..."
32
+ def axe n = 80
33
+ if n < length then
34
+ l = ELLIPSE.length
35
+ if n >= l then
36
+ n -= l
37
+ else
38
+ n, l = 0, n
39
+ end
40
+ self[ 0, n] << ELLIPSE[0,l]
41
+ else
42
+ self
43
+ end
44
+ end
45
+ def axe! n = 80
46
+ if n < length then
47
+ l = ELLIPSE.length
48
+ if n >= l then
49
+ n -= l
50
+ else
51
+ n, l = 0, n
52
+ end
53
+ slice! n...nil
54
+ self << ELLIPSE[0,l]
55
+ end
56
+ end
57
+ def starts_with? oth ; o = oth.to_str ; o.length if start_with? o ; end
58
+ def ends_with? oth ; o = oth.to_str ; length - o.length if end_with? o ; end
59
+ alias starts_with starts_with?
60
+ alias ends_with ends_with?
61
+ end
62
+ class Dir ; def entries! ; entries - %w(. ..) ; end ; end
63
+ end
64
+
data/lib/intar/prompt.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # intar/prompt.rb -- Prompt for Intar
3
3
  #
4
4
 
5
- require "supplement"
5
+ require "intar/foreign/supplement"
6
6
  require "reline"
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
  # intar/redirect.rb -- Output redirection for Intar
3
3
  #
4
4
 
5
- require "supplement"
5
+ require "intar/foreign/supplement"
6
6
 
7
7
 
8
8
  class Intar
data/lib/intar/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  class Intar
6
6
 
7
- VERSION = "2.17".freeze
7
+ VERSION = "2.19".freeze
8
8
 
9
9
  end
10
10
 
data/lib/intar.rb CHANGED
@@ -2,8 +2,8 @@
2
2
  # intar.rb -- Interactive Ruby evaluation
3
3
  #
4
4
 
5
- require "supplement"
6
- require "supplement/terminal"
5
+ require "intar/foreign/supplement"
6
+ require "intar/foreign/supplement/terminal"
7
7
  require "intar/version"
8
8
  require "intar/prompt"
9
9
  require "intar/redirect"
@@ -150,6 +150,10 @@ class Intar
150
150
  end
151
151
  (execute OLD_SET).call r, @n
152
152
  @n += 1
153
+ rescue
154
+ switchcolor 33
155
+ puts "Internal error."
156
+ show_exception
153
157
  end
154
158
  r
155
159
  ensure
@@ -324,7 +328,6 @@ class Intar
324
328
 
325
329
  # :stopdoc:
326
330
  ARROW = "=> "
327
- ELLIPSIS = "..."
328
331
  # :startdoc:
329
332
 
330
333
  def display r
@@ -335,18 +338,12 @@ class Intar
335
338
  i = ARROW.dup
336
339
  i << r.inspect
337
340
  if s > 0 then
338
- siz, = $stdout.wingeom
339
- siz *= s
340
- if i.length > siz then
341
- i.cut! siz-ELLIPSIS.length
342
- i << ELLIPSIS
343
- end
341
+ width, = $stdout.wingeom
342
+ i.axe! width*s
344
343
  end
345
344
  puts i
346
345
  end
347
346
 
348
- PACKAGE_BACKTRACE = %r/#{File.basename __FILE__, ".rb"}.*:\d+:in/
349
-
350
347
  def show_exception
351
348
  unless $!.to_s.empty? then
352
349
  switchcolor 1, 31
@@ -356,10 +353,8 @@ class Intar
356
353
  switchcolor 22, 31
357
354
  puts "(#{$!.class})"
358
355
  switchcolor 33
359
- $@.each { |b|
360
- break if b =~ PACKAGE_BACKTRACE
361
- puts b
362
- }
356
+ $@.pop until $@.empty? or $@.last.start_with? self.class.name
357
+ puts $@
363
358
  switchcolor
364
359
  end
365
360
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intar
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.17'
4
+ version: '2.19'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-12-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: appl
@@ -24,20 +23,6 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '1'
27
- - !ruby/object:Gem::Dependency
28
- name: supplement
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2'
41
26
  - !ruby/object:Gem::Dependency
42
27
  name: reline
43
28
  requirement: !ruby/object:Gem::Requirement
@@ -65,6 +50,8 @@ files:
65
50
  - README
66
51
  - bin/intar
67
52
  - lib/intar.rb
53
+ - lib/intar/foreign/supplement.rb
54
+ - lib/intar/foreign/supplement/terminal.rb
68
55
  - lib/intar/prompt.rb
69
56
  - lib/intar/redirect.rb
70
57
  - lib/intar/version.rb
@@ -72,7 +59,6 @@ homepage: http://www.bertram-scharpf.de
72
59
  licenses:
73
60
  - BSD-2-Clause
74
61
  metadata: {}
75
- post_install_message:
76
62
  rdoc_options: []
77
63
  require_paths:
78
64
  - lib
@@ -88,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
74
  version: '0'
89
75
  requirements:
90
76
  - Ruby and some small Gems; Readline
91
- rubygems_version: 3.4.22
92
- signing_key:
77
+ rubygems_version: 3.7.1
93
78
  specification_version: 4
94
79
  summary: Interactive Ruby
95
80
  test_files: []