dsl-python 0.19.0 → 0.20.0
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/dsl/python/types/array.rb +45 -12
- data/lib/dsl/python/types/string.rb +17 -24
- data/lib/dsl/python/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79b4ff2a17e321801b7d0f6f1f0ede3803b05560caca9602c2d7d190483c3a81
|
|
4
|
+
data.tar.gz: 4773c0bdc56d29aff9507ea1a9147abd566632b28088ed982e8882d9ce18d1ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae9e7d3899600e11d18fe39f8f7e2013ff818c546598c0f8944dbf4374e152d7362a470cac93622dd878f884b353290967aa295b9cc1b52c4cf84dddb0835038
|
|
7
|
+
data.tar.gz: c5be922b1ab00dc12affa16cd5cf9375a71507c183260f4873c5db9f5c2c6d964752db11803dffed1213bb51e9978f79c9f7c2c005523a06b3f7ed7430c14b7a
|
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require "io/console"
|
|
2
3
|
|
|
3
4
|
class Array
|
|
5
|
+
def append(item)
|
|
6
|
+
self.<<(item)
|
|
7
|
+
end
|
|
8
|
+
|
|
4
9
|
def __
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
names = %w[
|
|
11
|
+
list.__add__( list.__ge__( list.__iter__() list.__reversed__()
|
|
12
|
+
list.__class__( list.__getattribute__( list.__le__( list.__rmul__(
|
|
13
|
+
list.__class_getitem__( list.__getitem__( list.__len__() list.__setattr__(
|
|
14
|
+
list.__contains__( list.__getstate__() list.__lt__( list.__setitem__(
|
|
15
|
+
list.__delattr__( list.__gt__( list.__mul__( list.__sizeof__()
|
|
16
|
+
list.__delitem__( list.__hash__( list.__ne__( list.__str__(
|
|
17
|
+
list.__dir__() list.__iadd__( list.__new__( list.__subclasshook__(
|
|
18
|
+
list.__doc__( list.__imul__( list.__reduce__() list.__eq__(
|
|
19
|
+
list.__init__( list.__reduce_ex__() list.__format__( list.__init_subclass__()
|
|
20
|
+
list.__repr__()]
|
|
21
|
+
Dsl::Python.puts_in_columns(names.sort)
|
|
17
22
|
end
|
|
18
23
|
|
|
24
|
+
def __add__(other) = self.concat(other)
|
|
25
|
+
def __getitem__(index) = self.at(index)
|
|
26
|
+
def __len__ = self.length
|
|
27
|
+
def __sizeof__ = 40 + self.count * 8
|
|
28
|
+
# require 'objspace'
|
|
29
|
+
# mi_array = ["npython", "cli", "version"]
|
|
30
|
+
# puts ObjectSpace.memsize_of(mi_array)
|
|
31
|
+
def __str__ = self.to_s
|
|
32
|
+
|
|
19
33
|
def to_s
|
|
20
34
|
inspect
|
|
21
35
|
end
|
|
22
36
|
end
|
|
37
|
+
|
|
38
|
+
module Dsl
|
|
39
|
+
module Python
|
|
40
|
+
def self.puts_in_columns(values)
|
|
41
|
+
space = " "
|
|
42
|
+
tab = space * 3
|
|
43
|
+
max_value = values.map {_1.length}.max
|
|
44
|
+
max_value += tab.size
|
|
45
|
+
|
|
46
|
+
max_screen = IO.console.winsize[1]
|
|
47
|
+
max_col = max_screen / max_value
|
|
48
|
+
values.each_slice(max_col) do |items|
|
|
49
|
+
words = items.map { _1 + space * (max_value - _1.length)}
|
|
50
|
+
puts words.join
|
|
51
|
+
end
|
|
52
|
+
nil
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -3,31 +3,24 @@ class String
|
|
|
3
3
|
self % arg
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
def join(list)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def
|
|
11
|
-
downcase
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def upper
|
|
15
|
-
upcase
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def replace(a, b)
|
|
19
|
-
tr(a, b)
|
|
20
|
-
end
|
|
6
|
+
def join(list) = list.join(self)
|
|
7
|
+
def lower = downcase
|
|
8
|
+
def replace(a, b) = tr(a, b)
|
|
9
|
+
def title = capitalize
|
|
10
|
+
def upper = upcase
|
|
21
11
|
|
|
22
12
|
def __
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
names = %w[
|
|
14
|
+
str.__add__( str.__getattribute__( str.__le__( str.__repr__()
|
|
15
|
+
str.__class__( str.__getitem__( str.__len__() str.__rmod__(
|
|
16
|
+
str.__contains__( str.__getnewargs__() str.__lt__( str.__rmul__(
|
|
17
|
+
str.__delattr__( str.__getstate__() str.__mod__( str.__setattr__(
|
|
18
|
+
str.__dir__() str.__gt__( str.__mul__( str.__sizeof__()
|
|
19
|
+
str.__doc__ str.__hash__() str.__ne__( str.__str__()
|
|
20
|
+
str.__eq__( str.__init__( str.__new__( str.__subclasshook__(
|
|
21
|
+
str.__format__( str.__init_subclass__() str.__reduce__()
|
|
22
|
+
str.__ge__( str.__iter__() str.__reduce_ex__(
|
|
23
|
+
]
|
|
24
|
+
Dsl::Python.puts_in_columns(names.sort)
|
|
32
25
|
end
|
|
33
26
|
end
|
data/lib/dsl/python/version.rb
CHANGED