muflax 0.2.5 → 0.2.6
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
- checksums.yaml.gz.sig +0 -0
- data/Gemfile.lock +1 -1
- data/lib/muflax/panes.rb +31 -20
- data/lib/muflax/table.rb +1 -1
- data/lib/muflax/value.rb +1 -1
- data/muflax.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e70421f893de0859ccaa17fa1a9c1494d5886d9
|
4
|
+
data.tar.gz: 802a0fed3386db1e8a9b1129cbf136c4da9348a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7457a9c3c6462c4eac1e2137693cede786c9340c4448556c2931abdf864658f4f0296507b464d76c4cd15b53319c1249117edd127ab4ae73c3e0b7351923e6
|
7
|
+
data.tar.gz: 2a87180a6af908e7a4f397e0065776bb7382864c5e122200d99e50621a25a2d9de239c910188135f243ca44fd71b7f75bf34fb50eea7051d64bd67212813b393
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
data/lib/muflax/panes.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- encoding: utf-8 -*-
|
3
|
-
# Copyright
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
4
|
# License: GNU GPLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
5
|
|
6
6
|
module Kernel
|
@@ -55,12 +55,12 @@ class Panes
|
|
55
55
|
@sections.last
|
56
56
|
end
|
57
57
|
|
58
|
-
def total_lines ; @height * @columns
|
59
|
-
def remaining_lines ; total_lines - @used_lines
|
60
|
-
def remaining_lines_on_column ; remaining_lines % @
|
61
|
-
def used_columns ; @used_lines / @height
|
62
|
-
def remaining_columns ; @columns - used_columns
|
63
|
-
def column_full? ; remaining_lines_on_column <=
|
58
|
+
def total_lines ; @height * @columns ; end
|
59
|
+
def remaining_lines ; [total_lines - @used_lines, 0].max ; end
|
60
|
+
def remaining_lines_on_column ; remaining_lines <= 0 ? 0 : (remaining_lines % @column_height) ; end
|
61
|
+
def used_columns ; @used_lines / @height ; end
|
62
|
+
def remaining_columns ; @columns - used_columns ; end
|
63
|
+
def column_full? ; remaining_lines_on_column <= 0 ; end
|
64
64
|
|
65
65
|
def new_column
|
66
66
|
unless column_full?
|
@@ -74,8 +74,7 @@ class Panes
|
|
74
74
|
lines = [*lines].flatten
|
75
75
|
section = new_section
|
76
76
|
left = remaining_lines_on_column
|
77
|
-
|
78
|
-
# ap h: @height, t: total_lines, r: remaining_lines, rc: remaining_lines_on_column, l: lines
|
77
|
+
rem = remaining_lines
|
79
78
|
|
80
79
|
num = case max
|
81
80
|
when :all ; lines.size
|
@@ -87,22 +86,34 @@ class Panes
|
|
87
86
|
num = [num, remaining_lines].min
|
88
87
|
@used_lines += num
|
89
88
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
89
|
+
case
|
90
|
+
when header
|
91
|
+
h = lines.first
|
92
|
+
lines = lines[1..-1]
|
93
|
+
div = h.sub(/^\s+/){|s| @divider*s.size}.sub(/\s+$/){|s| @divider*s.size}
|
94
|
+
section.divider = div + @divider * (@column_width - div.str_length)
|
95
|
+
|
96
|
+
when @need_divider
|
97
|
+
@used_lines += 1
|
98
|
+
num -= 1 if max != :all or num >= rem # compensate for the divider
|
99
|
+
section.divider = @divider * @column_width
|
101
100
|
end
|
102
101
|
|
102
|
+
num = [num, rem].min
|
103
103
|
to_print = tail ? lines.last(num) : lines.first(num)
|
104
104
|
@need_divider = ! column_full?
|
105
105
|
|
106
|
+
# ap(
|
107
|
+
# height: @height,
|
108
|
+
# total: total_lines,
|
109
|
+
# rem: rem,
|
110
|
+
# left: left,
|
111
|
+
# rem_lines: remaining_lines,
|
112
|
+
# rem_column: remaining_lines_on_column,
|
113
|
+
# lines: lines,
|
114
|
+
# num: num
|
115
|
+
# )
|
116
|
+
|
106
117
|
to_print.each do |line|
|
107
118
|
section << line.truncate(@column_width, omission: "⇏")
|
108
119
|
end
|
data/lib/muflax/table.rb
CHANGED
data/lib/muflax/value.rb
CHANGED
data/muflax.gemspec
CHANGED
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
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- muflax
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
9xjevPGDZ+8y8wc8/mXBPK1pTaBh2oi8947HaTq8EadxezFs2Je+oSnMbygfo/a7
|
29
29
|
0rbAHpJPtzql3a4+gjK54qkJUWSUjWuLMHFIHhMt1laowNJUio6ASGx8tfzgLLnZ
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2017-07-
|
31
|
+
date: 2017-07-27 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
metadata.gz.sig
CHANGED
Binary file
|