vll 0.0.2 → 0.0.3
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/bin/vl +19 -10
- data/bin/vll +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b15751061629612b9ce0631e5ffce50cd1bc49d
|
4
|
+
data.tar.gz: 82be2cbd7eebb2dd8850954c5b0a94c4c1a517a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ae95011d219f39caf6dfbfbb4e141bfd37a42c1cf934830dff0d05713c09d0ea723b80ed163f349d2b6caf1ebdb867cb3f4fbdddb272d61b228109042b0414
|
7
|
+
data.tar.gz: 59fa7b009f937a2c70e6cdc080998a00dead8398a04f05dabaa9afe7808f4b19c2b9fe20f61306f0fa036db380325b2bd1310e54ba80c8fb703b49e513be8e6f
|
data/bin/vl
CHANGED
@@ -92,23 +92,32 @@ end
|
|
92
92
|
|
93
93
|
max_widths = []
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
options[:
|
99
|
-
begin
|
100
|
-
line = f_iter.next rescue break
|
101
|
-
lnum += 1
|
102
|
-
end while lnum < options[:skip] or line =~ options[:comment]
|
95
|
+
file = open file_name
|
96
|
+
|
97
|
+
file.each_line.with_index.reduce 0 do |pnum, (line, lnum)|
|
98
|
+
next pnum if lnum < options[:skip] or line =~ options[:comment]
|
103
99
|
line.chomp.split(options[:separator]).each_with_index do |c, i|
|
104
100
|
# -1 because it's possible that c is empty and i is out of range
|
105
101
|
if max_widths.fetch(i, -1) < c.length then max_widths[i] = c.length end
|
106
102
|
end
|
103
|
+
(pnum += 1) < options[:probe_lines] ? pnum : break
|
107
104
|
end
|
105
|
+
|
106
|
+
#lnum = 0
|
107
|
+
#options[:probe_lines].times do
|
108
|
+
# begin
|
109
|
+
# line = file.next rescue break
|
110
|
+
# lnum += 1
|
111
|
+
# end while lnum < options[:skip] or line =~ options[:comment]
|
112
|
+
# line.chomp.split(options[:separator]).each_with_index do |c, i|
|
113
|
+
# # -1 because it's possible that c is empty and i is out of range
|
114
|
+
# if max_widths.fetch(i, -1) < c.length then max_widths[i] = c.length end
|
115
|
+
# end
|
116
|
+
#end
|
108
117
|
|
109
|
-
|
118
|
+
file.rewind
|
110
119
|
|
111
|
-
|
120
|
+
file.each_line.with_index do |line, lnum|
|
112
121
|
if lnum < options[:skip] or line =~ options[:comment] then
|
113
122
|
print line
|
114
123
|
next
|
data/bin/vll
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xzhu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Nicely format columns of a large CSV/TSV file according to their content
|
14
14
|
width, using first few lines as estimation thus extremely fast. Customizable.
|