ttable 0.0.7 → 0.0.8
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/.travis.yml +1 -0
- data/Gemfile.ci +11 -0
- data/Guardfile +0 -3
- data/lib/terminal/table.rb +5 -1
- data/lib/terminal/table/version.rb +1 -1
- data/spec/terminal/table_spec.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 829caabb9f6ecd7558801ce9018bb718b782a761
|
4
|
+
data.tar.gz: 13c4d80c988f1e6540a36680a202762fc44bb5c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ee3b47945d736053de60e3e85e9d89d0f1fdacf8805a664ffc1ed5d56f108fc3a093af66b48a4fce39df1ece39a2272d49275f3b20b93bcdcdd63037003d4b6
|
7
|
+
data.tar.gz: 89fce1106da7dcd7813942f308b1932b803d995d0cfcec999dc47b4a1ac6f735ed83cfe84d3b03b954b27f56d92bd0dfe6e575511da9e2c0c2c9416ead69844d
|
data/.travis.yml
CHANGED
data/Gemfile.ci
ADDED
data/Guardfile
CHANGED
data/lib/terminal/table.rb
CHANGED
@@ -65,7 +65,11 @@ module Terminal
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def add_object(object, options)
|
68
|
-
|
68
|
+
if object.respond_to?(:to_hash)
|
69
|
+
add_hash(object.to_hash, options)
|
70
|
+
elsif object.respond_to?(:each)
|
71
|
+
@rows << object
|
72
|
+
end
|
69
73
|
end
|
70
74
|
|
71
75
|
def add_hash(hash, options)
|
data/spec/terminal/table_spec.rb
CHANGED
@@ -22,6 +22,19 @@ module Terminal
|
|
22
22
|
describe Table do
|
23
23
|
it { should respond_to :to_s }
|
24
24
|
|
25
|
+
describe 'initialize with array of array' do
|
26
|
+
let(:array) { [%w{ hello 1 }, %w{ world 2 } ] }
|
27
|
+
subject { Table.new(array) }
|
28
|
+
|
29
|
+
expected = <<END
|
30
|
+
+-------+---+
|
31
|
+
| hello | 1 |
|
32
|
+
| world | 2 |
|
33
|
+
+-------+---+
|
34
|
+
END
|
35
|
+
its(:to_s) { should == expected.gsub(/^(\s+)/, '') }
|
36
|
+
end
|
37
|
+
|
25
38
|
describe 'initialize with hash' do
|
26
39
|
let(:hash) { { foo: 'bar' } }
|
27
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Forrest Ye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- .gitignore
|
64
64
|
- .travis.yml
|
65
65
|
- Gemfile
|
66
|
+
- Gemfile.ci
|
66
67
|
- Guardfile
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|