tableparser 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/tableparser.rb +8 -4
- data/lib/tableparser/version.rb +1 -1
- data/tableparser.gemspec +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 157517a0d7bbebd067ce32359d7531b47c5a02ba6b02f981f918a16673974f4d
|
4
|
+
data.tar.gz: d7d397841c334ebf374d744ac5efbb8a60e7d49b26d05fdf251406402c66b427
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a191ce862dbf426f97c583c11aded6347eb8c066030003cd3584e463849c884308ebd57b0bd9119ee4803bec54779cf2d642e82b574e47c036c16a2d0f8ad5b
|
7
|
+
data.tar.gz: e6b8435c1265883819d72b28c1a3c6824d79bc053b5b8b428ea5bab0e4fb63d3149d941ca0a42dbfee2e6f9380820f4f551e2286b2bc8bab75d8c0c9546a8f94
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tableparser (0.1
|
4
|
+
tableparser (1.0.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
22
|
rspec-support (~> 3.8.0)
|
23
23
|
rspec-support (3.8.0)
|
24
|
-
yard (0.9.
|
24
|
+
yard (0.9.20)
|
25
25
|
|
26
26
|
PLATFORMS
|
27
27
|
ruby
|
@@ -31,7 +31,7 @@ DEPENDENCIES
|
|
31
31
|
rake (~> 10.0)
|
32
32
|
rspec (~> 3.8.0)
|
33
33
|
tableparser!
|
34
|
-
yard (
|
34
|
+
yard (>= 0.9.20)
|
35
35
|
|
36
36
|
BUNDLED WITH
|
37
|
-
2.0.
|
37
|
+
2.0.2
|
data/lib/tableparser.rb
CHANGED
@@ -3,10 +3,10 @@ require "tableparser/version"
|
|
3
3
|
# Helpers for table formatted results
|
4
4
|
module Tableparser
|
5
5
|
# @overload parse(io)
|
6
|
-
# @param [
|
6
|
+
# @param [IO] io io with source data to parse
|
7
7
|
# @return [Array<Array<String>>] rows
|
8
8
|
# @overload parse(io, &block)
|
9
|
-
# @param [
|
9
|
+
# @param [IO] io io with source data to parse
|
10
10
|
# @yieldparam [Array<String>] row each row
|
11
11
|
#
|
12
12
|
# Parses output from tables (often from SQL queries) to CSV-like array of
|
@@ -22,6 +22,8 @@ module Tableparser
|
|
22
22
|
# | val | val |
|
23
23
|
# +---------+---------+
|
24
24
|
#
|
25
|
+
# The block form streams from the input IO instead of reading all at once
|
26
|
+
#
|
25
27
|
# @example
|
26
28
|
# Tableparser.parse(STDIN) # =>
|
27
29
|
# [['col1', 'col2'], ['val', 'val'], ['val', 'val']]
|
@@ -43,12 +45,12 @@ module Tableparser
|
|
43
45
|
end
|
44
46
|
|
45
47
|
# @overload parse_to_struct(io, struct)
|
46
|
-
# @param [
|
48
|
+
# @param [IO] io io with source data to parse
|
47
49
|
# @param [Class] struct class that rows will be parsed as
|
48
50
|
# @return [Array<struct>] an array of instances of the +struct+ with fields
|
49
51
|
# set from the corresponding columns
|
50
52
|
# @overload parse(io, struct, &block)
|
51
|
-
# @param [
|
53
|
+
# @param [IO] io io with source data to parse
|
52
54
|
# @yieldparam [struct] row each row
|
53
55
|
#
|
54
56
|
# Assumes +struct+ was from +Struct.new(:col1, :col2)+. The code sets values on
|
@@ -56,6 +58,8 @@ module Tableparser
|
|
56
58
|
#
|
57
59
|
# *Note*: the code will downcase column names when setting.
|
58
60
|
#
|
61
|
+
# Since it builds on +.parse+, the block here form also streams from the
|
62
|
+
# input IO
|
59
63
|
def self.parse_to_struct(io, struct)
|
60
64
|
cols = nil
|
61
65
|
|
data/lib/tableparser/version.rb
CHANGED
data/tableparser.gemspec
CHANGED
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 2.0"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.8.0"
|
31
|
-
spec.add_development_dependency "yard", "
|
31
|
+
spec.add_development_dependency "yard", ">= 0.9.20"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tableparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Margolis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.9.
|
61
|
+
version: 0.9.20
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.9.
|
68
|
+
version: 0.9.20
|
69
69
|
description: Help parse table-like output such as from raw SQL
|
70
70
|
email:
|
71
71
|
- zbmargolis@gmail.com
|
@@ -109,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
|
113
|
-
rubygems_version: 2.7.9
|
112
|
+
rubygems_version: 3.0.3
|
114
113
|
signing_key:
|
115
114
|
specification_version: 4
|
116
115
|
summary: Help parse table-like output
|