tableware 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.rubocop-https---raw-githubusercontent-com-dvmtn-house-style-master-rubocop-yml +64 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +128 -0
- data/LICENSE.txt +21 -0
- data/README.md +114 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tableware/parser.rb +49 -0
- data/lib/tableware/version.rb +5 -0
- data/lib/tableware.rb +14 -0
- data/tableware.gemspec +30 -0
- metadata +174 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bdf63d976f7bc10b88173faff66b1648b68f121e
|
4
|
+
data.tar.gz: 5ec2eeb4cc455f7732329d5d1720c792327cae7e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9118c0d6f8c9d9e17b5521e6b08c51f5a221627c4168b5f452612790e75bcca1cbd63bc517a010d55620a9aca02b55ce27e264e3f6099436e9cfbe1544ed31b8
|
7
|
+
data.tar.gz: 99e85bec1a7fd1a8e72f1e64536ec2454227e65e023af07adb2038ca0eb6686900658118829f8ab8f813356729bdb66dfb369ad023fc7a1eabe7eaeb1b167830
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -0,0 +1,64 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- '**/Rakefile'
|
4
|
+
- '**/config.ru'
|
5
|
+
Exclude:
|
6
|
+
- 'db/**/*'
|
7
|
+
- 'config/**/*'
|
8
|
+
- 'script/**/*'
|
9
|
+
- 'tmp/**/*'
|
10
|
+
- 'vendor/**/*'
|
11
|
+
- 'bin/**/*'
|
12
|
+
- 'log/**/*'
|
13
|
+
|
14
|
+
Rails:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Style/AlignHash:
|
18
|
+
EnforcedHashRocketStyle: table
|
19
|
+
EnforcedColonStyle: table
|
20
|
+
EnforcedLastArgumentHashStyle: ignore_implicit
|
21
|
+
SupportedLastArgumentHashStyles: ignore_implicit
|
22
|
+
|
23
|
+
Style/DefWithParentheses:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/MethodDefParentheses:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/Encoding:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/PercentLiteralDelimiters:
|
36
|
+
PreferredDelimiters:
|
37
|
+
'%': ()
|
38
|
+
'%i': '[]'
|
39
|
+
'%q': '[]'
|
40
|
+
'%Q': '[]'
|
41
|
+
'%r': '[]'
|
42
|
+
'%s': '[]'
|
43
|
+
'%w': '[]'
|
44
|
+
'%W': '[]'
|
45
|
+
'%x': '[]'
|
46
|
+
|
47
|
+
Style/PredicateName:
|
48
|
+
NamePrefixBlacklist:
|
49
|
+
- is_
|
50
|
+
- has_
|
51
|
+
- have_
|
52
|
+
- the_
|
53
|
+
- a_
|
54
|
+
- should_
|
55
|
+
|
56
|
+
Style/SignalException:
|
57
|
+
EnforcedStyle: only_raise
|
58
|
+
|
59
|
+
Style/EmptyLinesAroundClassBody:
|
60
|
+
EnforcedStyle: empty_lines
|
61
|
+
|
62
|
+
Metrics/LineLength:
|
63
|
+
Max: 140
|
64
|
+
AllowURI: true
|
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.3
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at adam@devmountain.co.uk. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tableware (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract_type (0.0.7)
|
10
|
+
adamantium (0.2.0)
|
11
|
+
ice_nine (~> 0.11.0)
|
12
|
+
memoizable (~> 0.4.0)
|
13
|
+
ast (2.3.0)
|
14
|
+
axiom-types (0.1.1)
|
15
|
+
descendants_tracker (~> 0.0.4)
|
16
|
+
ice_nine (~> 0.11.0)
|
17
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
18
|
+
codeclimate-engine-rb (0.1.0)
|
19
|
+
virtus (~> 1.0)
|
20
|
+
coercible (1.0.0)
|
21
|
+
descendants_tracker (~> 0.0.1)
|
22
|
+
colorize (0.7.7)
|
23
|
+
concord (0.1.5)
|
24
|
+
adamantium (~> 0.2.0)
|
25
|
+
equalizer (~> 0.0.9)
|
26
|
+
descendants_tracker (0.0.4)
|
27
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
28
|
+
diff-lcs (1.2.5)
|
29
|
+
docile (1.1.5)
|
30
|
+
equalizer (0.0.11)
|
31
|
+
fasterer (0.1.11)
|
32
|
+
colorize (~> 0.7)
|
33
|
+
ruby_parser (~> 3.6)
|
34
|
+
flay (2.6.1)
|
35
|
+
ruby_parser (~> 3.0)
|
36
|
+
sexp_processor (~> 4.0)
|
37
|
+
flog (4.3.2)
|
38
|
+
ruby_parser (~> 3.1, > 3.1.0)
|
39
|
+
sexp_processor (~> 4.4)
|
40
|
+
ice_nine (0.11.2)
|
41
|
+
json (1.8.3)
|
42
|
+
memoizable (0.4.2)
|
43
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
44
|
+
parser (2.3.1.2)
|
45
|
+
ast (~> 2.2)
|
46
|
+
powerpack (0.1.1)
|
47
|
+
private_attr (1.1.0)
|
48
|
+
procto (0.0.3)
|
49
|
+
rainbow (2.1.0)
|
50
|
+
rake (10.5.0)
|
51
|
+
rake-n-bake (1.4.0)
|
52
|
+
rake (~> 10)
|
53
|
+
term-ansicolor (~> 1.3)
|
54
|
+
reek (3.8.1)
|
55
|
+
codeclimate-engine-rb (~> 0.1.0)
|
56
|
+
parser (~> 2.2, >= 2.2.2.5)
|
57
|
+
private_attr (~> 1.1)
|
58
|
+
rainbow (~> 2.0)
|
59
|
+
unparser (~> 0.2.2)
|
60
|
+
rspec (3.4.0)
|
61
|
+
rspec-core (~> 3.4.0)
|
62
|
+
rspec-expectations (~> 3.4.0)
|
63
|
+
rspec-mocks (~> 3.4.0)
|
64
|
+
rspec-core (3.4.4)
|
65
|
+
rspec-support (~> 3.4.0)
|
66
|
+
rspec-expectations (3.4.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.4.0)
|
69
|
+
rspec-mocks (3.4.1)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.4.0)
|
72
|
+
rspec-support (3.4.1)
|
73
|
+
rubocop (0.42.0)
|
74
|
+
parser (>= 2.3.1.1, < 3.0)
|
75
|
+
powerpack (~> 0.1)
|
76
|
+
rainbow (>= 1.99.1, < 3.0)
|
77
|
+
ruby-progressbar (~> 1.7)
|
78
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
79
|
+
ruby-progressbar (1.8.1)
|
80
|
+
ruby_parser (3.7.3)
|
81
|
+
sexp_processor (~> 4.1)
|
82
|
+
rubycritic (2.4.1)
|
83
|
+
flay (= 2.6.1)
|
84
|
+
flog (= 4.3.2)
|
85
|
+
parser (>= 2.2.0, < 3.0)
|
86
|
+
reek (= 3.8.1)
|
87
|
+
virtus (~> 1.0)
|
88
|
+
sexp_processor (4.6.1)
|
89
|
+
simplecov (0.11.2)
|
90
|
+
docile (~> 1.1.0)
|
91
|
+
json (~> 1.8)
|
92
|
+
simplecov-html (~> 0.10.0)
|
93
|
+
simplecov-html (0.10.0)
|
94
|
+
term-ansicolor (1.3.2)
|
95
|
+
tins (~> 1.0)
|
96
|
+
thread_safe (0.3.5)
|
97
|
+
tins (1.12.0)
|
98
|
+
unicode-display_width (1.1.0)
|
99
|
+
unparser (0.2.5)
|
100
|
+
abstract_type (~> 0.0.7)
|
101
|
+
adamantium (~> 0.2.0)
|
102
|
+
concord (~> 0.1.5)
|
103
|
+
diff-lcs (~> 1.2.5)
|
104
|
+
equalizer (~> 0.0.9)
|
105
|
+
parser (~> 2.3.0)
|
106
|
+
procto (~> 0.0.2)
|
107
|
+
virtus (1.0.5)
|
108
|
+
axiom-types (~> 0.1)
|
109
|
+
coercible (~> 1.0)
|
110
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
111
|
+
equalizer (~> 0.0, >= 0.0.9)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
bundler (~> 1.12)
|
118
|
+
fasterer
|
119
|
+
rake (~> 10.0)
|
120
|
+
rake-n-bake
|
121
|
+
rspec (~> 3.0)
|
122
|
+
rubocop
|
123
|
+
rubycritic
|
124
|
+
simplecov
|
125
|
+
tableware!
|
126
|
+
|
127
|
+
BUNDLED WITH
|
128
|
+
1.12.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Adam Whittingham
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# Tableware
|
2
|
+
|
3
|
+
Tableware is a tiny gem for making it easier to define data in an text table.
|
4
|
+
Table rows are parsed into either arrays or hashes.
|
5
|
+
|
6
|
+
For example, writing:
|
7
|
+
|
8
|
+
```
|
9
|
+
[
|
10
|
+
[ "Type A", true, false, 2016 ],
|
11
|
+
[ "Type B", "only on alternating Wednesdays", false, 2017 ],
|
12
|
+
[ "Type C", :never, true, 2016 ]
|
13
|
+
].each do |args|
|
14
|
+
// Some test or permissions check or something
|
15
|
+
end
|
16
|
+
```
|
17
|
+
is fine but it can be a pain to format at work with, especially for larger data sets.
|
18
|
+
|
19
|
+
Tableware lets you trade a bit of parsing for nicer text tables. Instead of the above, you could write:
|
20
|
+
|
21
|
+
```
|
22
|
+
table = %q[
|
23
|
+
| Type | Valid | Infinite | Year Introduced |
|
24
|
+
----------------------------------------------------------------------------------
|
25
|
+
| Type A | true | false | 2016 |
|
26
|
+
| Type B | Only on alternating Wednesdays | false | 2017 |
|
27
|
+
| Type C | never | true | 2016 |
|
28
|
+
]
|
29
|
+
Tableware.arrays.each do |args|
|
30
|
+
// Some test or permissions check or something
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
The upside is that you get a much more human friendly table to read, which will save you time by making it something you can quickly scan over.
|
35
|
+
The downside is that everything appears on the other side as a string, so you may need to do some `.to_i`ing to convert things back into the type you're expecting.
|
36
|
+
|
37
|
+
*Please note* that this isn't always going to be better than defining your data in another format; arrays, giant hashes of doom, JSON/YAML or even CSV may me easier to work with. This is another option and one which may be better for that middle ground when your data makes arrays hard to format but it's not big enough for you to want to extract it to an external file. Or perhaps you just like Cucumber scenario outlines and want something similar in rspec!
|
38
|
+
Whatever your reasoning, this is just one more option for formatting your data.
|
39
|
+
|
40
|
+
This gem has been created as a quick experiement to see if or how ofen this feature could be useful.
|
41
|
+
If you find it useful, please like it or better yet, extend it!
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
Add this line to your application's Gemfile:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
gem 'tableware'
|
49
|
+
```
|
50
|
+
|
51
|
+
And then execute:
|
52
|
+
|
53
|
+
$ bundle
|
54
|
+
|
55
|
+
Or install it yourself as:
|
56
|
+
|
57
|
+
$ gem install tableware
|
58
|
+
|
59
|
+
## Usage
|
60
|
+
|
61
|
+
Tableware accepts text tables following these rules:
|
62
|
+
|
63
|
+
- Columns delimited by the `|` character
|
64
|
+
- Header row is optional but if specified, it must be followed by a line of `-` or `=` characters
|
65
|
+
- Start and end `|` characters on a row are optional; `| A | B |` is the same as `A | B`
|
66
|
+
|
67
|
+
|
68
|
+
Tableware provides two main methods for getting your data back out of the table:
|
69
|
+
|
70
|
+
1. `Tableware.arrays` returns an array of arrays
|
71
|
+
2. `Tableware.hashes` returns an array of hashes, where the keys come from the headings row
|
72
|
+
|
73
|
+
|
74
|
+
For example:
|
75
|
+
|
76
|
+
```
|
77
|
+
input = '
|
78
|
+
Hero | Value | Hours Played
|
79
|
+
------------------------------------------
|
80
|
+
Phara | 10 | 22
|
81
|
+
Mercy | 9 | 11
|
82
|
+
Winston | 3 | 2
|
83
|
+
'
|
84
|
+
|
85
|
+
Tableware.arrays(input)
|
86
|
+
# => [
|
87
|
+
['Phara', '10', '22'],
|
88
|
+
['Mercy', '9', '11'],
|
89
|
+
['Winston', '3', '2']
|
90
|
+
]
|
91
|
+
|
92
|
+
Tableware.hashes(input)
|
93
|
+
#=> [
|
94
|
+
{ hero: 'Phara', value: '10', hours_played: 22 },
|
95
|
+
{ hero: 'Mercy', value: '9', hours_played: 11 },
|
96
|
+
{ hero: 'Winston', value: '3', hours_played: 2 }
|
97
|
+
]
|
98
|
+
```
|
99
|
+
|
100
|
+
## Development
|
101
|
+
|
102
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
103
|
+
|
104
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
105
|
+
|
106
|
+
## Contributing
|
107
|
+
|
108
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/AdamWhittingham/tableware. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
109
|
+
|
110
|
+
|
111
|
+
## License
|
112
|
+
|
113
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
114
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rake-n-bake'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task default: [
|
8
|
+
:clean,
|
9
|
+
:"bake:code_quality:all",
|
10
|
+
:"bake:rspec",
|
11
|
+
:"bake:coverage:check_specs",
|
12
|
+
:"bake:rubocop",
|
13
|
+
:"bake:rubycritic",
|
14
|
+
:"bake:fasterer",
|
15
|
+
:"bake:ok_rainbow"
|
16
|
+
]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'tableware'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
class Tableware
|
2
|
+
|
3
|
+
class Parser
|
4
|
+
|
5
|
+
class TableWithoutHeaderError < StandardError; end
|
6
|
+
|
7
|
+
ROW_START = /^\s*\|/
|
8
|
+
ROW_END = /\|\s*$/
|
9
|
+
|
10
|
+
def arrays(input)
|
11
|
+
make_arrays(input)
|
12
|
+
end
|
13
|
+
|
14
|
+
def hashes(input)
|
15
|
+
items = make_arrays(input)
|
16
|
+
raise TableWithoutHeaderError, 'Sorry, only text tables with headers rows can be turned into hashes' unless @headers
|
17
|
+
items.map! { |row| @headers.zip(row).to_h }
|
18
|
+
end
|
19
|
+
|
20
|
+
private def make_arrays(input)
|
21
|
+
lines = prepare_lines(input)
|
22
|
+
lines[@data_start..-1].map { |line| parse_line(line) }
|
23
|
+
end
|
24
|
+
|
25
|
+
private def prepare_lines(input)
|
26
|
+
lines = input.strip.lines
|
27
|
+
|
28
|
+
@data_start = lines[1] =~ /^\s*[-=]+\s*$/ ? 2 : 0
|
29
|
+
if @data_start.nonzero?
|
30
|
+
@headers = parse_line(lines[0])
|
31
|
+
.map!(&:downcase)
|
32
|
+
.map! { |head| head.gsub(/\s+/, '_') }
|
33
|
+
.map!(&:to_sym)
|
34
|
+
end
|
35
|
+
|
36
|
+
lines
|
37
|
+
end
|
38
|
+
|
39
|
+
private def parse_line(line)
|
40
|
+
line
|
41
|
+
.sub(ROW_START, '')
|
42
|
+
.sub(ROW_END, '')
|
43
|
+
.split('|')
|
44
|
+
.map!(&:strip)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/lib/tableware.rb
ADDED
data/tableware.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tableware/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'tableware'
|
8
|
+
spec.version = Tableware::VERSION
|
9
|
+
spec.authors = ['Adam Whittingham']
|
10
|
+
spec.email = ['adam@devmountain.co.uk']
|
11
|
+
|
12
|
+
spec.summary = 'A nice way of parsing text tables into Arrays or Hashes '
|
13
|
+
spec.description = 'A nice way of parsing text tables into Ararys or Hashes, for clearer code. Great for tests and permissions matrixes!'
|
14
|
+
spec.homepage = "https://github.com/AdamWhittingham/tableware"
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
25
|
+
spec.add_development_dependency 'rake-n-bake'
|
26
|
+
spec.add_development_dependency 'simplecov'
|
27
|
+
spec.add_development_dependency 'rubycritic'
|
28
|
+
spec.add_development_dependency 'rubocop'
|
29
|
+
spec.add_development_dependency 'fasterer'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tableware
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Whittingham
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-n-bake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubycritic
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fasterer
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: A nice way of parsing text tables into Ararys or Hashes, for clearer
|
126
|
+
code. Great for tests and permissions matrixes!
|
127
|
+
email:
|
128
|
+
- adam@devmountain.co.uk
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".rubocop-https---raw-githubusercontent-com-dvmtn-house-style-master-rubocop-yml"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- ".ruby-version"
|
138
|
+
- CODE_OF_CONDUCT.md
|
139
|
+
- Gemfile
|
140
|
+
- Gemfile.lock
|
141
|
+
- LICENSE.txt
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- bin/console
|
145
|
+
- bin/setup
|
146
|
+
- lib/tableware.rb
|
147
|
+
- lib/tableware/parser.rb
|
148
|
+
- lib/tableware/version.rb
|
149
|
+
- tableware.gemspec
|
150
|
+
homepage: https://github.com/AdamWhittingham/tableware
|
151
|
+
licenses:
|
152
|
+
- MIT
|
153
|
+
metadata: {}
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
require_paths:
|
157
|
+
- lib
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
requirements: []
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 2.4.5.1
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: A nice way of parsing text tables into Arrays or Hashes
|
174
|
+
test_files: []
|