muflax 0.3.18 → 0.3.19

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
  SHA256:
3
- metadata.gz: 1a633eb18821a470c9d818d57bcc4406aaf79861522957defd698ce2bfdc4ced
4
- data.tar.gz: d682e16f1eec598a949b2d22db1dee20a75a1b9cdb9d9e04ff32a37485dd9556
3
+ metadata.gz: 1d7cf5cadb93be4cc8e7fe1ea28a03f2a69d37c9ffa0342cacf5dac56610b480
4
+ data.tar.gz: 4295cf464987fd55013d8b68c569a27458b7f22e6b5bc43590389319dfe0aeab
5
5
  SHA512:
6
- metadata.gz: 102246d9feb7a32a2fee1ce34cad9d6e122e808a53eece94fc9833e1071ff0254a714193c1a1e9511659dbd659084ebb293a090ca477b8c1da1116d59da93d63
7
- data.tar.gz: aab37b803b43ab5241ab075beecf1c495eb2390e3aa9865c429e27746dc8edaeaa1aeada91035f6987155c9809945a020e05a992471e78b24825d3c160b878fe
6
+ metadata.gz: 52a6f307763e7815bd3537c2ed380761bf3c40f248eb64e12af9335a04c559860be3482881901a1589d4ed40289479825970a2d195d0a2686360c25a249cd90e
7
+ data.tar.gz: 30dcec504bb2950513ef8b2821f49b81b8c204c4096e637e5b95108812eeba4834c3e85769968a6d2b92d4754a9359b49e1028945e51237c615a6b007401e6f1
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- muflax (0.3.18)
4
+ muflax (0.3.19)
5
5
  awesome_print (~> 1)
6
6
  debug_inspector (~> 0.0)
7
7
  highline (< 1.7)
data/lib/muflax/align.rb CHANGED
@@ -58,24 +58,46 @@ class Array
58
58
  columns = [columns, line.size].max
59
59
  end
60
60
 
61
- # justify all columns
62
- lengths = columns.times.map do |column|
63
- lines.reduce(0){|sum, line| [line[column].str_length, sum].max}
64
- end
61
+ columns -= 1 # very last column is always un-aligned
62
+
63
+ columns.times.map do |column|
64
+ # calculate column width
65
+ wants = []
66
+ new_block = false
67
+ width = 0
68
+ first = 0
69
+ max_cols = column + 1
65
70
 
66
- lines.map! do |line|
67
- # align columns
68
- line.map!.with_index do |elem, column|
69
- # how much the element is internally longer than it appears
70
- elem_diff = elem.to_s.length - elem.str_length
71
+ lines.each.with_index do |line, cur|
72
+ if new_block
73
+ new_block = false
74
+ first = cur
75
+ width = 0
76
+ end
71
77
 
72
- just_function.call(elem, lengths[column] + elem_diff, column)
78
+ w = line[column]&.size
79
+ w = nil if line.size == max_cols # treat last column as useless
80
+
81
+ if w.nil? # block done
82
+ wants << [first, cur, width] unless width == 0
83
+ new_block = true
84
+ else
85
+ width = [width, w].max
86
+ end
73
87
  end
88
+ wants << [first, lines.size, width] unless new_block or width == 0 # last block
74
89
 
75
- # join line back together
76
- line.join(str)
90
+ # justify column
91
+ wants.each do |from, to, width|
92
+ lines[from...to].each do |line|
93
+ if elem = line[column]
94
+ elem_diff = elem.to_s.length - elem.str_length # how much the element is internally longer than it appears
95
+ line[column] = just_function.call(elem, width + elem_diff, column)
96
+ end
97
+ end
98
+ end
77
99
  end
78
100
 
79
- lines
101
+ lines.map{|l| l.join(str)}
80
102
  end
81
103
  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.3.18"
3
+ s.version = "0.3.19"
4
4
 
5
5
  s.authors = ["muflax"]
6
6
  s.summary = "muflax standard library"
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- Zu�|�3�D�|z<�%�B����[?d]�0��T(���qjF"<�)�o��.�h��|'%���?m{$��ƕ�~;�`:�؍G��4?LBS#V�,x��`�� �|�Ћ������8�H�eNr�BV*�++�� x��yS��1w�*�cy9GaX;[ar��L���x��²x� {�1 ��dk�:ׇ�d�44C܎��HvGB^C����+��? w$�G
2
- �݇�SBKZY��֙�����IϚ��.*Q%XJ�W2�
1
+ ��gZ.�)��ݚh���"����Gi��_v��oc��_{k�_%fxl�� �H��z`7��dG�ƚ�\�!و��H-W+�J��h"T�劍�욟����<4�=�r����s�`/{� �][��X�:(}OJ���lD���ܛկd�A�OK.
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.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - muflax
@@ -28,7 +28,7 @@ cert_chain:
28
28
  jj4QBQUG5hER1ZAFf+RXdy4RSimjXedOgvebDGeTafOJyhtLsxsh6UKCViHVGzkw
29
29
  fhGEJ1deAR/i8RPCblyBDtl7Ved3uX8izfU9LItVY+HOAzl69Qp0fe2TYH+y4uCO
30
30
  -----END CERTIFICATE-----
31
- date: 2019-02-07 00:00:00.000000000 Z
31
+ date: 2019-02-11 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: awesome_print
metadata.gz.sig CHANGED
Binary file