muflax 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e18db37633af5a0f277d21797637376d2721b2e4
4
- data.tar.gz: 497b57bad006b26bc036fc34923ce042a5152845
3
+ metadata.gz: c3c658af855414bea8ca9b03391eef441f7a3706
4
+ data.tar.gz: 7c45ee303680f6c7bffe588ff345ddecd04dc1cc
5
5
  SHA512:
6
- metadata.gz: 598dc5ef8f411290cd55b22f90a105633c6e97bbf3bb2f6aeb923abd82f3785b57daf7e5a0a3c51855533f3dd36fc7e90edafc3022df332bc06d534f6abd3b65
7
- data.tar.gz: 951337d9166fd81021e323d5b1c86645199d874c4e936d2e0156669cf086dbb342bb4a18a27faf4dcc6df94503d42ab58c5d35e34ca0d00cee5e00bae67b761b
6
+ metadata.gz: 0bfa5c9b931ddd083e37e42c7908cdda757c8bf62b8e4c202d374dffb38ec1de66e58cde98520f2d3f43add24461fbca60a020ffc4ae0f67e98b99580911ef4c
7
+ data.tar.gz: 5d4af076c5f8c31569c1a0c9392cf9a37365b0e8b660e484ade2901b4ce0afd258926388ffa7afacdbbb4a43851cbdc7a0adfc471169e20f3b2dacafabac5ca9
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- fQ? ��4.iw��ܝd��C�"2l��MQ��g
2
- v�<�s~��O�|��j�&��|��rQ��K����f vP6�KFF��d3lm*oHNFh�t���/��!�mO����\E�IN�w��hW2��I��X��ORo>^45&�AOdE�mb;A�U�*T$Ax%���1fbwN�n b�@�äL^y�ۏ�0.�^���oK�N;&�.k0��Ԫ_
1
+ =����G,����*ta`f����VRc�BY�,���p:n)���c>��Vt|���f��)�����6��L�e��M)�����4O*�pU��v�6�#>����\�o��"�m��G�]��g��]�*v{�捚˂!xvS�l� �m32�1d9�b�
2
+ c��w���4��2)a��5}ٱ���z��&����Yد�ᡣ�� r'�!�hSx$q�� cK����&>) 9��.5)z8ts�|���
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- muflax (0.2.4)
4
+ muflax (0.2.5)
5
5
  activesupport (~> 5)
6
6
  awesome_print
7
7
  debug_inspector
data/lib/muflax/string.rb CHANGED
@@ -18,4 +18,32 @@ class String
18
18
  def whackuum str=/\s+/
19
19
  self.split(str).map(&:strip)
20
20
  end
21
+
22
+ ANSIColorRegexp = Regexp.new(/(?: \e \[ \d+ (?: ;\d+)* m )+/x)
23
+
24
+ def truncate length, omission: "..."
25
+ return self if self.length <= length
26
+
27
+ ss = StringScanner.new(self)
28
+ out = ss.scan(ANSIColorRegexp) || ""
29
+ cut_length = length - omission.str_length
30
+ used = 0
31
+ cut_at = 0
32
+
33
+ while used < length and not ss.eos?
34
+ out << ss.getch
35
+ c = ss.scan(ANSIColorRegexp)
36
+ out << c unless c.nil?
37
+ used += 1
38
+
39
+ cut_at = out.length if used == cut_length
40
+ end
41
+
42
+ if not ss.eos?
43
+ out = out[0, cut_at]
44
+ out << omission
45
+ end
46
+
47
+ out
48
+ end
21
49
  end
data/muflax.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "muflax"
3
- s.version = "0.2.4"
3
+ s.version = "0.2.5"
4
4
 
5
5
  s.authors = ["muflax"]
6
6
  s.summary = "muflax standard library"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muflax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - muflax
metadata.gz.sig CHANGED
Binary file