atv 0.0.10 → 0.1.0
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 +5 -5
- data/README.md +11 -3
- data/atv.gemspec +3 -2
- data/lib/atv.rb +3 -2
- data/lib/atv/version.rb +1 -1
- data/test/atv_test.rb +4 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6851e0b146072fde213bbf6fb686c39ab366fed056d8bb7860d8ac7af09b43de
|
4
|
+
data.tar.gz: 1fb2e9df3b10052fe0def7fe48ed61b5e0e28e17a06985d0de00193f1b9507d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990b8a36bccd11ff01d8f177f5555c10c6b0e558e0596c339747a468e1a0158d372e951ed8d565d180cab2ce9cbd6fa87885b3ed4f5c7ad4082c40a8747c0c41
|
7
|
+
data.tar.gz: e021c158d45fedce55dc1d75e5122c2fa1ac15962b63073f0bca9ac1d6213109048139ee02c6ddea54cccfdf3a3dd602cdc89b9d289709df3b3029a952518cd3
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ It allows you to read data formatted like this:
|
|
13
13
|
|------------------+--------------------|
|
14
14
|
</pre>
|
15
15
|
|
16
|
-
or,
|
16
|
+
or, _without_ separators, like this:
|
17
17
|
|
18
18
|
<pre>
|
19
19
|
|------------------+--------------------|
|
@@ -27,7 +27,10 @@ or, without separators, like this:
|
|
27
27
|
In [Ascii Tables For Clearer Testing][1] I discuss using ascii tables to improve comprehension
|
28
28
|
of software tests.
|
29
29
|
|
30
|
-
[1]:
|
30
|
+
[1]: https://punctuatedproductivity.wordpress.com/2016/02/02/ascii-tables-for-clearer-testing/
|
31
|
+
|
32
|
+
This gem was originally created when I worked at Indiegogo. Indiegogo has graciously transferred ownership of the
|
33
|
+
gem to me so that I can maintain it going forward.
|
31
34
|
|
32
35
|
## Installation
|
33
36
|
|
@@ -73,6 +76,9 @@ Rows are returned or yielded as [CSV::Row][2] objects.
|
|
73
76
|
|-----------------------+------------------------------+-----------------------------------|
|
74
77
|
| false | false | |
|
75
78
|
|-----------------------+------------------------------+-----------------------------------|
|
79
|
+
#| commented rows | not included | As you would expect, commented |
|
80
|
+
#| | | rows are not included |
|
81
|
+
#|-----------------------+------------------------------+-----------------------------------|
|
76
82
|
</pre>
|
77
83
|
|
78
84
|
**Reading a String**
|
@@ -93,9 +99,11 @@ atv.each do |row|
|
|
93
99
|
end
|
94
100
|
```
|
95
101
|
|
102
|
+
More examples can be found in the Examples of Testing With ASCII Tables [repo](https://github.com/kellyfelkins/examples_of_testing_with_ascii_tables).
|
103
|
+
|
96
104
|
## Contributing
|
97
105
|
|
98
|
-
1. Fork it ( https://github.com/
|
106
|
+
1. Fork it ( https://github.com/kellyfelkins/atv )
|
99
107
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
100
108
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
101
109
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/atv.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "atv"
|
8
8
|
spec.version = Atv::VERSION
|
9
9
|
spec.authors = ["Kelly Felkins"]
|
10
|
-
spec.email = ["kelly@
|
10
|
+
spec.email = ["kelly@restlater.com"]
|
11
11
|
spec.summary = "Read Ascii Table Values"
|
12
12
|
spec.description = "Read data from an ascii table."
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/kellyfelkins/atv"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.11"
|
23
24
|
end
|
data/lib/atv.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "./atv/version"
|
2
2
|
require 'csv'
|
3
3
|
|
4
4
|
class ATV
|
@@ -11,7 +11,7 @@ class ATV
|
|
11
11
|
}
|
12
12
|
|
13
13
|
attr_reader :headers
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(io)
|
16
16
|
@io = io
|
17
17
|
@has_separators = has_separators?(@io)
|
@@ -24,6 +24,7 @@ class ATV
|
|
24
24
|
def each
|
25
25
|
line_data = []
|
26
26
|
@io.each_line do |line|
|
27
|
+
next if line =~ /^\s*#/
|
27
28
|
line.chomp!
|
28
29
|
if (!@has_separators && !line_data.empty?) || line =~ /^\|\-/
|
29
30
|
csv_row = CSV::Row.new(@headers, line_data.
|
data/lib/atv/version.rb
CHANGED
data/test/atv_test.rb
CHANGED
@@ -14,6 +14,9 @@ describe ATV do
|
|
14
14
|
| Zoe | February 15, 2484 | |
|
15
15
|
| Washburne | | |
|
16
16
|
|-----------+--------------------+--------------|
|
17
|
+
# | Inara | October 14, 2489 | |
|
18
|
+
# | Sara | | |
|
19
|
+
# |-----------+--------------------+--------------|
|
17
20
|
| Derrial | null | true |
|
18
21
|
| Book | | |
|
19
22
|
|-----------+--------------------+--------------|
|
@@ -30,7 +33,7 @@ describe ATV do
|
|
30
33
|
@atv = ATV.new(StringIO.new(@data_as_table))
|
31
34
|
end
|
32
35
|
|
33
|
-
it 'with a block it yields rows of data as CSV rows' do
|
36
|
+
it 'with a block it yields rows of data as CSV rows and ignores commented lines' do
|
34
37
|
i = 0
|
35
38
|
|
36
39
|
@atv.each do |row|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Felkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,9 +38,23 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.11'
|
41
55
|
description: Read data from an ascii table.
|
42
56
|
email:
|
43
|
-
- kelly@
|
57
|
+
- kelly@restlater.com
|
44
58
|
executables: []
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
@@ -54,7 +68,7 @@ files:
|
|
54
68
|
- lib/atv.rb
|
55
69
|
- lib/atv/version.rb
|
56
70
|
- test/atv_test.rb
|
57
|
-
homepage: https://github.com/
|
71
|
+
homepage: https://github.com/kellyfelkins/atv
|
58
72
|
licenses:
|
59
73
|
- MIT
|
60
74
|
metadata: {}
|
@@ -74,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
88
|
version: '0'
|
75
89
|
requirements: []
|
76
90
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.7.6
|
78
92
|
signing_key:
|
79
93
|
specification_version: 4
|
80
94
|
summary: Read Ascii Table Values
|