intar 2.18 → 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: 5196f1e809ea091ee1999bce0d6cbee4ce63121b396db3808bf3e847419bd0e1
4
- data.tar.gz: 4a7ed17f8e8c4501fcc1bc18eb330080aa061e2deec660737cff2fcb3dfedc27
3
+ metadata.gz: 2906a0c6492a351a047ba1b17fd008648b4b696c3d6725f1690cc955c73d4b6c
4
+ data.tar.gz: 9f97fe2061b9db44f37976c06980c6d998391d5d1f109aa436bb20e015a7433e
5
5
  SHA512:
6
- metadata.gz: 55f6cabc0e30a859c63924c8002494bff765f89e67a7c05a36322146772b3b09f8e5fa122c498813fbb99563339fcccf10b4100268cf17ddba5637afccd284a7
7
- data.tar.gz: d0ee5d8af9071df83c26a22859a516ed2530dbcdfdcb56b12bc86e78749086ac10bb9f16b17339c04843545f1f67b69c9ee99ad66c0b41cb4c4e65d973dcad4d
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.18".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"
@@ -328,7 +328,6 @@ class Intar
328
328
 
329
329
  # :stopdoc:
330
330
  ARROW = "=> "
331
- ELLIPSIS = "..."
332
331
  # :startdoc:
333
332
 
334
333
  def display r
@@ -339,12 +338,8 @@ class Intar
339
338
  i = ARROW.dup
340
339
  i << r.inspect
341
340
  if s > 0 then
342
- siz, = $stdout.wingeom
343
- siz *= s
344
- if i.length > siz then
345
- i.cut! siz-ELLIPSIS.length
346
- i << ELLIPSIS
347
- end
341
+ width, = $stdout.wingeom
342
+ i.axe! width*s
348
343
  end
349
344
  puts i
350
345
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intar
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.18'
4
+ version: '2.19'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: appl
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '1'
26
- - !ruby/object:Gem::Dependency
27
- name: supplement
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '2'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2'
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: reline
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +50,8 @@ files:
64
50
  - README
65
51
  - bin/intar
66
52
  - lib/intar.rb
53
+ - lib/intar/foreign/supplement.rb
54
+ - lib/intar/foreign/supplement/terminal.rb
67
55
  - lib/intar/prompt.rb
68
56
  - lib/intar/redirect.rb
69
57
  - lib/intar/version.rb
@@ -86,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
74
  version: '0'
87
75
  requirements:
88
76
  - Ruby and some small Gems; Readline
89
- rubygems_version: 3.6.3
77
+ rubygems_version: 3.7.1
90
78
  specification_version: 4
91
79
  summary: Interactive Ruby
92
80
  test_files: []