tty-table 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -10
- data/CHANGELOG.md +12 -5
- data/Gemfile +1 -1
- data/README.md +16 -13
- data/lib/tty-table.rb +1 -1
- data/lib/tty/table/field.rb +6 -7
- data/lib/tty/table/version.rb +1 -1
- data/tty-table.gemspec +7 -7
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 062c7bdf2fba5620d4cb5cb0fbf3381d34819fe0
|
4
|
+
data.tar.gz: 3737a0e80a9c52e5b2b70a44ab8394d3ff7eaf1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9805f9eae1f8b23608e0a4a58f7b5ebfb28e24f2e72db9b72ca093f2d340fc795f45b7216c460f05e8d221788e2817ced244ce6d40dc88a12caf0b84c965774
|
7
|
+
data.tar.gz: 51ee6e3c33b02b11d6e0571d49d488a17c7c4dddb901e8a990cb8c37127db9c03b41b0231bbdc816985b40b14b79eeb0a3a601ec72464a1d1fb3d450e1b78d65
|
data/.travis.yml
CHANGED
@@ -5,19 +5,14 @@ cache: bundler
|
|
5
5
|
bundler_args: --without yard benchmarks
|
6
6
|
script: "bundle exec rake ci"
|
7
7
|
rvm:
|
8
|
-
- 1.9.3
|
9
8
|
- 2.0.0
|
10
|
-
- 2.1
|
11
|
-
- 2.2
|
12
|
-
- 2.3.
|
9
|
+
- 2.1.0
|
10
|
+
- 2.2.5
|
11
|
+
- 2.3.1
|
13
12
|
- ruby-head
|
13
|
+
- jruby-9.1.1.0
|
14
|
+
- jruby-head
|
14
15
|
matrix:
|
15
|
-
include:
|
16
|
-
- rvm: jruby-19mode
|
17
|
-
- rvm: jruby-20mode
|
18
|
-
- rvm: jruby-21mode
|
19
|
-
- rvm: jruby-head
|
20
|
-
- rvm: rbx-2
|
21
16
|
allow_failures:
|
22
17
|
- rvm: ruby-head
|
23
18
|
- rvm: jruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.6.0] - 2016-10-26
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change to use unicode-display_width dependency
|
7
|
+
* Upgrade verse dependency
|
8
|
+
|
3
9
|
## [v0.5.0] - 2016-02-11
|
4
10
|
|
5
11
|
### Changed
|
@@ -51,8 +57,9 @@
|
|
51
57
|
|
52
58
|
* Initial implementation and release
|
53
59
|
|
54
|
-
[v0.
|
55
|
-
[v0.
|
56
|
-
[v0.
|
57
|
-
[v0.
|
58
|
-
[v0.
|
60
|
+
[v0.6.0]: https://github.com/piotrmurach/tty-table/compare/v0.5.0...v0.6.0
|
61
|
+
[v0.5.0]: https://github.com/piotrmurach/tty-table/compare/v0.4.0...v0.5.0
|
62
|
+
[v0.4.0]: https://github.com/piotrmurach/tty-table/compare/v0.3.0...v0.4.0
|
63
|
+
[v0.3.0]: https://github.com/piotrmurach/tty-table/compare/v0.2.0...v0.3.0
|
64
|
+
[v0.2.0]: https://github.com/piotrmurach/tty-table/compare/v0.1.0...v0.2.0
|
65
|
+
[v0.1.0]: https://github.com/piotrmurach/tty-table/compare/v0.1.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
# TTY::Table
|
1
|
+
# TTY::Table [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/tty-table.svg)][gem]
|
4
|
-
[![Build Status](https://secure.travis-ci.org/
|
5
|
-
[![Code Climate](https://codeclimate.com/github/
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/
|
7
|
-
[![Inline docs](http://inch-ci.org/github/
|
4
|
+
[![Build Status](https://secure.travis-ci.org/piotrmurach/tty-table.svg?branch=master)][travis]
|
5
|
+
[![Code Climate](https://codeclimate.com/github/piotrmurach/tty-table/badges/gpa.svg)][codeclimate]
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-table/badge.svg?branch=master)][coverage]
|
7
|
+
[![Inline docs](http://inch-ci.org/github/piotrmurach/tty-table.svg?branch=master)][inchpages]
|
8
8
|
|
9
|
+
[gitter]: https://gitter.im/piotrmurach/tty
|
9
10
|
[gem]: http://badge.fury.io/rb/tty-table
|
10
|
-
[travis]: http://travis-ci.org/
|
11
|
-
[codeclimate]: https://codeclimate.com/github/
|
12
|
-
[coverage]: https://coveralls.io/
|
13
|
-
[inchpages]: http://inch-ci.org/github/
|
11
|
+
[travis]: http://travis-ci.org/piotrmurach/tty-table
|
12
|
+
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-table
|
13
|
+
[coverage]: https://coveralls.io/github/piotrmurach/tty-table
|
14
|
+
[inchpages]: http://inch-ci.org/github/piotrmurach/tty-table
|
14
15
|
|
15
16
|
> A flexible and intuitive table formatting.
|
16
17
|
|
17
|
-
**TTY::Table** provides independent table formatting component for [TTY](https://github.com/
|
18
|
+
**TTY::Table** provides independent table formatting component for [TTY](https://github.com/piotrmurach/tty) toolkit.
|
18
19
|
|
19
20
|
## Features
|
20
21
|
|
@@ -545,7 +546,7 @@ table.render do |renderer|
|
|
545
546
|
end
|
546
547
|
```
|
547
548
|
|
548
|
-
All [supported colors](https://github.com/
|
549
|
+
All [supported colors](https://github.com/piotrmurach/pastel#3-supported-colors) are provided by the **Pastel** dependency.
|
549
550
|
|
550
551
|
### 3.6 Filter
|
551
552
|
|
@@ -575,9 +576,11 @@ end
|
|
575
576
|
To color even fields red on green background add filter like so
|
576
577
|
|
577
578
|
```ruby
|
579
|
+
pastel = Pastel.new
|
580
|
+
|
578
581
|
table.render do |renderer|
|
579
582
|
renderer.filter = proc do |val, row_index, col_index|
|
580
|
-
col_index % 2 == 1 ?
|
583
|
+
col_index % 2 == 1 ? pastel.red.on_green(val) : val
|
581
584
|
end
|
582
585
|
end
|
583
586
|
```
|
@@ -696,7 +699,7 @@ table.render width: 80, resize: true
|
|
696
699
|
|
697
700
|
## Contributing
|
698
701
|
|
699
|
-
1. Fork it ( https://github.com/
|
702
|
+
1. Fork it ( https://github.com/piotrmurach/tty-table/fork )
|
700
703
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
701
704
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
702
705
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/tty-table.rb
CHANGED
data/lib/tty/table/field.rb
CHANGED
@@ -68,7 +68,7 @@ module TTY
|
|
68
68
|
#
|
69
69
|
# @api private
|
70
70
|
def initialize(value)
|
71
|
-
options
|
71
|
+
@value, options = extract_options(value)
|
72
72
|
@content = @value.to_s
|
73
73
|
@width = options[:width]
|
74
74
|
@alignment = options.fetch(:alignment) { nil }
|
@@ -80,14 +80,13 @@ module TTY
|
|
80
80
|
#
|
81
81
|
# @api private
|
82
82
|
def extract_options(value)
|
83
|
-
if value.
|
83
|
+
if value.is_a?(Hash)
|
84
84
|
options = value
|
85
|
-
|
85
|
+
value = options.fetch(:value)
|
86
86
|
else
|
87
|
-
@value = value
|
88
87
|
options = {}
|
89
88
|
end
|
90
|
-
options
|
89
|
+
[value, options]
|
91
90
|
end
|
92
91
|
|
93
92
|
# Reset to original value
|
@@ -101,7 +100,7 @@ module TTY
|
|
101
100
|
#
|
102
101
|
# @api public
|
103
102
|
def width
|
104
|
-
@width ||
|
103
|
+
@width || display_width(@content)
|
105
104
|
end
|
106
105
|
|
107
106
|
# Return number of lines this value spans.
|
@@ -157,7 +156,7 @@ module TTY
|
|
157
156
|
|
158
157
|
# @api public
|
159
158
|
def display_width(string)
|
160
|
-
|
159
|
+
Unicode::DisplayWidth.of(string)
|
161
160
|
end
|
162
161
|
end # Field
|
163
162
|
end # Table
|
data/lib/tty/table/version.rb
CHANGED
data/tty-table.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = [""]
|
11
11
|
spec.summary = %q{A flexible and intuitive table generator}
|
12
12
|
spec.description = %q{A flexible and intuitive table generator}
|
13
|
-
spec.homepage = "http://
|
13
|
+
spec.homepage = "http://piotrmurach.github.io/tty/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'equatable',
|
22
|
-
spec.add_dependency 'necromancer',
|
23
|
-
spec.add_dependency 'pastel',
|
24
|
-
spec.add_dependency 'tty-screen',
|
25
|
-
spec.add_dependency 'verse',
|
26
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'equatable', '~> 0.5.0'
|
22
|
+
spec.add_dependency 'necromancer', '~> 0.3.0'
|
23
|
+
spec.add_dependency 'pastel', '~> 0.6.0'
|
24
|
+
spec.add_dependency 'tty-screen', '~> 0.5.0'
|
25
|
+
spec.add_dependency 'verse', '~> 0.5.0'
|
26
|
+
spec.add_dependency 'unicode-display_width','~> 1.1.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
29
29
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,131 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equatable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: necromancer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pastel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.6.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.6.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tty-screen
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.5.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.5.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: verse
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.5.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.5.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: unicode-display_width
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.1.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 1.5.0
|
104
|
-
- - <
|
104
|
+
- - "<"
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '2.0'
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: 1.5.0
|
114
|
-
- - <
|
114
|
+
- - "<"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '2.0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rake
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
description: A flexible and intuitive table generator
|
@@ -135,9 +135,9 @@ executables: []
|
|
135
135
|
extensions: []
|
136
136
|
extra_rdoc_files: []
|
137
137
|
files:
|
138
|
-
- .gitignore
|
139
|
-
- .rspec
|
140
|
-
- .travis.yml
|
138
|
+
- ".gitignore"
|
139
|
+
- ".rspec"
|
140
|
+
- ".travis.yml"
|
141
141
|
- CHANGELOG.md
|
142
142
|
- Gemfile
|
143
143
|
- LICENSE.txt
|
@@ -283,7 +283,7 @@ files:
|
|
283
283
|
- tasks/coverage.rake
|
284
284
|
- tasks/spec.rake
|
285
285
|
- tty-table.gemspec
|
286
|
-
homepage: http://
|
286
|
+
homepage: http://piotrmurach.github.io/tty/
|
287
287
|
licenses:
|
288
288
|
- MIT
|
289
289
|
metadata: {}
|
@@ -293,17 +293,17 @@ require_paths:
|
|
293
293
|
- lib
|
294
294
|
required_ruby_version: !ruby/object:Gem::Requirement
|
295
295
|
requirements:
|
296
|
-
- -
|
296
|
+
- - ">="
|
297
297
|
- !ruby/object:Gem::Version
|
298
298
|
version: '0'
|
299
299
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
300
|
requirements:
|
301
|
-
- -
|
301
|
+
- - ">="
|
302
302
|
- !ruby/object:Gem::Version
|
303
303
|
version: '0'
|
304
304
|
requirements: []
|
305
305
|
rubyforge_project:
|
306
|
-
rubygems_version: 2.
|
306
|
+
rubygems_version: 2.5.1
|
307
307
|
signing_key:
|
308
308
|
specification_version: 4
|
309
309
|
summary: A flexible and intuitive table generator
|