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 +4 -4
- data/lib/intar/foreign/supplement/terminal.rb +15 -0
- data/lib/intar/foreign/supplement.rb +64 -0
- data/lib/intar/prompt.rb +1 -1
- data/lib/intar/redirect.rb +1 -1
- data/lib/intar/version.rb +1 -1
- data/lib/intar.rb +4 -9
- metadata +5 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2906a0c6492a351a047ba1b17fd008648b4b696c3d6725f1690cc955c73d4b6c
|
|
4
|
+
data.tar.gz: 9f97fe2061b9db44f37976c06980c6d998391d5d1f109aa436bb20e015a7433e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
data/lib/intar/redirect.rb
CHANGED
data/lib/intar/version.rb
CHANGED
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
|
-
|
|
343
|
-
|
|
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.
|
|
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:
|
|
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.
|
|
77
|
+
rubygems_version: 3.7.1
|
|
90
78
|
specification_version: 4
|
|
91
79
|
summary: Interactive Ruby
|
|
92
80
|
test_files: []
|