tty 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -3
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +42 -306
  5. data/lib/tty/{text → shell}/distance.rb +5 -27
  6. data/lib/tty/shell/suggestion.rb +42 -22
  7. data/lib/tty/version.rb +1 -1
  8. data/lib/tty.rb +2 -42
  9. data/spec/tty/{text → shell}/distance/distance_spec.rb +4 -4
  10. data/spec/tty/shell/distance/initialize_spec.rb +14 -0
  11. data/tty.gemspec +4 -3
  12. metadata +37 -269
  13. data/benchmarks/table.rb +0 -40
  14. data/lib/tty/table/border/ascii.rb +0 -32
  15. data/lib/tty/table/border/null.rb +0 -37
  16. data/lib/tty/table/border/row_line.rb +0 -18
  17. data/lib/tty/table/border/unicode.rb +0 -32
  18. data/lib/tty/table/border.rb +0 -222
  19. data/lib/tty/table/border_dsl.rb +0 -251
  20. data/lib/tty/table/border_options.rb +0 -53
  21. data/lib/tty/table/column_set.rb +0 -121
  22. data/lib/tty/table/columns.rb +0 -170
  23. data/lib/tty/table/error.rb +0 -18
  24. data/lib/tty/table/field.rb +0 -139
  25. data/lib/tty/table/header.rb +0 -133
  26. data/lib/tty/table/indentation.rb +0 -52
  27. data/lib/tty/table/operation/alignment.rb +0 -107
  28. data/lib/tty/table/operation/alignment_set.rb +0 -77
  29. data/lib/tty/table/operation/escape.rb +0 -30
  30. data/lib/tty/table/operation/filter.rb +0 -34
  31. data/lib/tty/table/operation/padding.rb +0 -95
  32. data/lib/tty/table/operation/truncation.rb +0 -55
  33. data/lib/tty/table/operation/wrapped.rb +0 -58
  34. data/lib/tty/table/operations.rb +0 -69
  35. data/lib/tty/table/orientation/horizontal.rb +0 -48
  36. data/lib/tty/table/orientation/vertical.rb +0 -38
  37. data/lib/tty/table/orientation.rb +0 -57
  38. data/lib/tty/table/padder.rb +0 -180
  39. data/lib/tty/table/renderer/ascii.rb +0 -16
  40. data/lib/tty/table/renderer/basic.rb +0 -294
  41. data/lib/tty/table/renderer/color.rb +0 -12
  42. data/lib/tty/table/renderer/unicode.rb +0 -21
  43. data/lib/tty/table/renderer.rb +0 -101
  44. data/lib/tty/table/row.rb +0 -217
  45. data/lib/tty/table/transformation.rb +0 -39
  46. data/lib/tty/table/validatable.rb +0 -64
  47. data/lib/tty/table.rb +0 -476
  48. data/lib/tty/text/truncation.rb +0 -99
  49. data/lib/tty/text/wrapping.rb +0 -118
  50. data/lib/tty/text.rb +0 -98
  51. data/spec/tty/table/access_spec.rb +0 -86
  52. data/spec/tty/table/add_row_spec.rb +0 -28
  53. data/spec/tty/table/border/ascii/rendering_spec.rb +0 -90
  54. data/spec/tty/table/border/new_spec.rb +0 -27
  55. data/spec/tty/table/border/null/rendering_spec.rb +0 -130
  56. data/spec/tty/table/border/options/from_spec.rb +0 -38
  57. data/spec/tty/table/border/options/new_spec.rb +0 -14
  58. data/spec/tty/table/border/unicode/rendering_spec.rb +0 -63
  59. data/spec/tty/table/border_options/new_spec.rb +0 -20
  60. data/spec/tty/table/border_options/update_spec.rb +0 -18
  61. data/spec/tty/table/column_set/extract_widths_spec.rb +0 -15
  62. data/spec/tty/table/column_set/total_width_spec.rb +0 -15
  63. data/spec/tty/table/column_set/widths_from_spec.rb +0 -51
  64. data/spec/tty/table/columns/enforce_spec.rb +0 -68
  65. data/spec/tty/table/columns/widths_spec.rb +0 -35
  66. data/spec/tty/table/data_spec.rb +0 -14
  67. data/spec/tty/table/each_spec.rb +0 -41
  68. data/spec/tty/table/each_with_index_spec.rb +0 -57
  69. data/spec/tty/table/empty_spec.rb +0 -23
  70. data/spec/tty/table/eql_spec.rb +0 -34
  71. data/spec/tty/table/field/equality_spec.rb +0 -51
  72. data/spec/tty/table/field/length_spec.rb +0 -21
  73. data/spec/tty/table/field/lines_spec.rb +0 -21
  74. data/spec/tty/table/field/new_spec.rb +0 -29
  75. data/spec/tty/table/field/width_spec.rb +0 -23
  76. data/spec/tty/table/filter_spec.rb +0 -23
  77. data/spec/tty/table/header/call_spec.rb +0 -30
  78. data/spec/tty/table/header/height_spec.rb +0 -27
  79. data/spec/tty/table/header/new_spec.rb +0 -25
  80. data/spec/tty/table/header/set_spec.rb +0 -20
  81. data/spec/tty/table/header/to_ary_spec.rb +0 -14
  82. data/spec/tty/table/header_spec.rb +0 -13
  83. data/spec/tty/table/indentation/insert_indent_spec.rb +0 -27
  84. data/spec/tty/table/initialize_spec.rb +0 -88
  85. data/spec/tty/table/operation/alignment/format_spec.rb +0 -47
  86. data/spec/tty/table/operation/alignment/new_spec.rb +0 -31
  87. data/spec/tty/table/operation/alignment_set/call_spec.rb +0 -39
  88. data/spec/tty/table/operation/alignment_set/each_spec.rb +0 -17
  89. data/spec/tty/table/operation/alignment_set/new_spec.rb +0 -27
  90. data/spec/tty/table/operation/alignment_set/to_ary_spec.rb +0 -14
  91. data/spec/tty/table/operation/escape/call_spec.rb +0 -16
  92. data/spec/tty/table/operation/filter/call_spec.rb +0 -17
  93. data/spec/tty/table/operation/truncation/call_spec.rb +0 -32
  94. data/spec/tty/table/operation/truncation/truncate_spec.rb +0 -22
  95. data/spec/tty/table/operation/wrapped/call_spec.rb +0 -33
  96. data/spec/tty/table/operation/wrapped/wrap_spec.rb +0 -23
  97. data/spec/tty/table/operations/new_spec.rb +0 -30
  98. data/spec/tty/table/options_spec.rb +0 -25
  99. data/spec/tty/table/orientation_spec.rb +0 -145
  100. data/spec/tty/table/padder/parse_spec.rb +0 -45
  101. data/spec/tty/table/padder/to_s_spec.rb +0 -14
  102. data/spec/tty/table/padding_spec.rb +0 -120
  103. data/spec/tty/table/properties_spec.rb +0 -25
  104. data/spec/tty/table/render_spec.rb +0 -63
  105. data/spec/tty/table/render_with_spec.rb +0 -106
  106. data/spec/tty/table/renderer/ascii/indentation_spec.rb +0 -41
  107. data/spec/tty/table/renderer/ascii/padding_spec.rb +0 -61
  108. data/spec/tty/table/renderer/ascii/render_spec.rb +0 -68
  109. data/spec/tty/table/renderer/ascii/resizing_spec.rb +0 -114
  110. data/spec/tty/table/renderer/ascii/separator_spec.rb +0 -28
  111. data/spec/tty/table/renderer/basic/alignment_spec.rb +0 -88
  112. data/spec/tty/table/renderer/basic/coloring_spec.rb +0 -46
  113. data/spec/tty/table/renderer/basic/extract_column_widths_spec.rb +0 -28
  114. data/spec/tty/table/renderer/basic/filter_spec.rb +0 -53
  115. data/spec/tty/table/renderer/basic/indentation_spec.rb +0 -48
  116. data/spec/tty/table/renderer/basic/multiline_content_spec.rb +0 -135
  117. data/spec/tty/table/renderer/basic/new_spec.rb +0 -22
  118. data/spec/tty/table/renderer/basic/options_spec.rb +0 -48
  119. data/spec/tty/table/renderer/basic/padding_spec.rb +0 -52
  120. data/spec/tty/table/renderer/basic/render_spec.rb +0 -57
  121. data/spec/tty/table/renderer/basic/resizing_spec.rb +0 -96
  122. data/spec/tty/table/renderer/basic/separator_spec.rb +0 -43
  123. data/spec/tty/table/renderer/basic/truncation_spec.rb +0 -35
  124. data/spec/tty/table/renderer/basic/wrapping_spec.rb +0 -40
  125. data/spec/tty/table/renderer/basic_spec.rb +0 -0
  126. data/spec/tty/table/renderer/border_spec.rb +0 -104
  127. data/spec/tty/table/renderer/render_spec.rb +0 -36
  128. data/spec/tty/table/renderer/select_spec.rb +0 -22
  129. data/spec/tty/table/renderer/style_spec.rb +0 -72
  130. data/spec/tty/table/renderer/unicode/indentation_spec.rb +0 -41
  131. data/spec/tty/table/renderer/unicode/padding_spec.rb +0 -61
  132. data/spec/tty/table/renderer/unicode/render_spec.rb +0 -68
  133. data/spec/tty/table/renderer/unicode/separator_spec.rb +0 -26
  134. data/spec/tty/table/renderer_spec.rb +0 -19
  135. data/spec/tty/table/rotate_spec.rb +0 -86
  136. data/spec/tty/table/row/access_spec.rb +0 -25
  137. data/spec/tty/table/row/call_spec.rb +0 -41
  138. data/spec/tty/table/row/data_spec.rb +0 -26
  139. data/spec/tty/table/row/each_spec.rb +0 -31
  140. data/spec/tty/table/row/equality_spec.rb +0 -73
  141. data/spec/tty/table/row/height_spec.rb +0 -27
  142. data/spec/tty/table/row/new_spec.rb +0 -41
  143. data/spec/tty/table/row/to_ary_spec.rb +0 -14
  144. data/spec/tty/table/to_s_spec.rb +0 -63
  145. data/spec/tty/table/transformation/extract_tuples_spec.rb +0 -35
  146. data/spec/tty/table/validatable/validate_options_spec.rb +0 -33
  147. data/spec/tty/table/validatable_spec.rb +0 -32
  148. data/spec/tty/text/distance/initialize_spec.rb +0 -14
  149. data/spec/tty/text/distance_spec.rb +0 -11
  150. data/spec/tty/text/truncate_spec.rb +0 -12
  151. data/spec/tty/text/truncation/initialize_spec.rb +0 -29
  152. data/spec/tty/text/truncation/truncate_spec.rb +0 -94
  153. data/spec/tty/text/wrap_spec.rb +0 -13
  154. data/spec/tty/text/wrapping/initialize_spec.rb +0 -25
  155. data/spec/tty/text/wrapping/wrap_spec.rb +0 -97
data/lib/tty.rb CHANGED
@@ -6,6 +6,7 @@ require 'necromancer'
6
6
  require 'tty-screen'
7
7
  require 'tty-spinner'
8
8
  require 'tty-progressbar'
9
+ require 'tty-table'
9
10
 
10
11
  require 'tty/version'
11
12
 
@@ -16,8 +17,6 @@ require 'tty/support/unicode'
16
17
 
17
18
  require 'tty/terminal'
18
19
  require 'tty/system'
19
- require 'tty/table'
20
- require 'tty/text'
21
20
  require 'tty/vector'
22
21
  require 'tty/shell'
23
22
  require 'tty/logger'
@@ -25,6 +24,7 @@ require 'tty/plugins'
25
24
 
26
25
  require 'tty/plugins/plugin'
27
26
 
27
+ require 'tty/shell/distance'
28
28
  require 'tty/shell/response_delegation'
29
29
  require 'tty/shell/question'
30
30
  require 'tty/shell/question/validation'
@@ -44,40 +44,6 @@ require 'tty/terminal/pager/system'
44
44
  require 'tty/system/which'
45
45
  require 'tty/system/editor'
46
46
 
47
- require 'tty/text/distance'
48
- require 'tty/text/truncation'
49
- require 'tty/text/wrapping'
50
-
51
- require 'tty/table/header'
52
- require 'tty/table/row'
53
- require 'tty/table/field'
54
-
55
- require 'tty/table/border'
56
- require 'tty/table/border_dsl'
57
- require 'tty/table/border_options'
58
- require 'tty/table/border/unicode'
59
- require 'tty/table/border/ascii'
60
- require 'tty/table/border/null'
61
- require 'tty/table/border/row_line'
62
-
63
- require 'tty/table/column_set'
64
- require 'tty/table/columns'
65
- require 'tty/table/orientation'
66
- require 'tty/table/orientation/horizontal'
67
- require 'tty/table/orientation/vertical'
68
- require 'tty/table/transformation'
69
- require 'tty/table/indentation'
70
- require 'tty/table/padder'
71
-
72
- require 'tty/table/operations'
73
- require 'tty/table/operation/alignment_set'
74
- require 'tty/table/operation/alignment'
75
- require 'tty/table/operation/truncation'
76
- require 'tty/table/operation/wrapped'
77
- require 'tty/table/operation/filter'
78
- require 'tty/table/operation/escape'
79
- require 'tty/table/operation/padding'
80
-
81
47
  module TTY
82
48
 
83
49
  # Raised when the argument type is different from expected
@@ -95,12 +61,6 @@ module TTY
95
61
  # Raised when the argument is not expected
96
62
  class InvalidArgument < ArgumentError; end
97
63
 
98
- # Raised when the table orientation is unkown
99
- class InvalidOrientationError < ArgumentError; end
100
-
101
- # Raised when the table cannot be resized
102
- class ResizeError < ArgumentError; end
103
-
104
64
  # Raised when the passed in validation argument is of wrong type
105
65
  class ValidationCoercion < TypeError; end
106
66
 
@@ -1,11 +1,11 @@
1
- # encoding: utf-8
1
+ # coding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe TTY::Text::Distance, '#distance' do
6
- let(:object) { described_class.new(*strings) }
5
+ RSpec.describe TTY::Shell::Distance, '.distance' do
6
+ let(:object) { described_class.new }
7
7
 
8
- subject(:distance) { object.distance }
8
+ subject(:distance) { object.distance(*strings) }
9
9
 
10
10
  context 'when nil' do
11
11
  let(:strings) { [nil, nil] }
@@ -0,0 +1,14 @@
1
+ # coding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe TTY::Shell::Distance, '#initialize' do
6
+ let(:strings) { ['abc', 'acb'] }
7
+
8
+ # subject(:distance) { described_class.new(*strings) }
9
+ #
10
+ # it { expect(distance.first).to eq(strings.first) }
11
+ #
12
+ # it { expect(distance.second).to eq(strings.last) }
13
+
14
+ end # initialize
data/tty.gemspec CHANGED
@@ -17,12 +17,13 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
+ gem.add_dependency 'tty-table', '~> 0.2.0'
21
+ gem.add_dependency 'tty-progressbar', '~> 0.5.0'
22
+ gem.add_dependency 'tty-screen', '~> 0.1.0'
23
+ gem.add_dependency 'tty-spinner', '~> 0.1.0'
20
24
  gem.add_dependency 'equatable', '~> 0.5.0'
21
25
  gem.add_dependency 'necromancer', '~> 0.3.0'
22
26
  gem.add_dependency 'pastel', '~> 0.4.0'
23
- gem.add_dependency 'tty-screen', '~> 0.1.0'
24
- gem.add_dependency 'tty-spinner', '~> 0.1.0'
25
- gem.add_dependency 'tty-progressbar', '~> 0.2.0'
26
27
 
27
28
  gem.add_development_dependency 'bundler', '~> 1.5'
28
29
  end
metadata CHANGED
@@ -1,59 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2015-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: equatable
14
+ name: tty-table
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.2.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
- version: 0.5.0
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: necromancer
28
+ name: tty-progressbar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 0.5.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
- version: 0.3.0
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: pastel
42
+ name: tty-screen
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.0
47
+ version: 0.1.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
- version: 0.4.0
54
+ version: 0.1.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: tty-screen
56
+ name: tty-spinner
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
@@ -67,33 +67,47 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.1.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: tty-spinner
70
+ name: equatable
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.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.1.0
82
+ version: 0.5.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: tty-progressbar
84
+ name: necromancer
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 0.2.0
89
+ version: 0.3.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: 0.2.0
96
+ version: 0.3.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: pastel
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.4.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.4.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -127,13 +141,13 @@ files:
127
141
  - README.md
128
142
  - Rakefile
129
143
  - benchmarks/shell.rb
130
- - benchmarks/table.rb
131
144
  - images/tty.png
132
145
  - lib/tty.rb
133
146
  - lib/tty/logger.rb
134
147
  - lib/tty/plugins.rb
135
148
  - lib/tty/plugins/plugin.rb
136
149
  - lib/tty/shell.rb
150
+ - lib/tty/shell/distance.rb
137
151
  - lib/tty/shell/question.rb
138
152
  - lib/tty/shell/question/modifier.rb
139
153
  - lib/tty/shell/question/validation.rb
@@ -149,40 +163,6 @@ files:
149
163
  - lib/tty/system.rb
150
164
  - lib/tty/system/editor.rb
151
165
  - lib/tty/system/which.rb
152
- - lib/tty/table.rb
153
- - lib/tty/table/border.rb
154
- - lib/tty/table/border/ascii.rb
155
- - lib/tty/table/border/null.rb
156
- - lib/tty/table/border/row_line.rb
157
- - lib/tty/table/border/unicode.rb
158
- - lib/tty/table/border_dsl.rb
159
- - lib/tty/table/border_options.rb
160
- - lib/tty/table/column_set.rb
161
- - lib/tty/table/columns.rb
162
- - lib/tty/table/error.rb
163
- - lib/tty/table/field.rb
164
- - lib/tty/table/header.rb
165
- - lib/tty/table/indentation.rb
166
- - lib/tty/table/operation/alignment.rb
167
- - lib/tty/table/operation/alignment_set.rb
168
- - lib/tty/table/operation/escape.rb
169
- - lib/tty/table/operation/filter.rb
170
- - lib/tty/table/operation/padding.rb
171
- - lib/tty/table/operation/truncation.rb
172
- - lib/tty/table/operation/wrapped.rb
173
- - lib/tty/table/operations.rb
174
- - lib/tty/table/orientation.rb
175
- - lib/tty/table/orientation/horizontal.rb
176
- - lib/tty/table/orientation/vertical.rb
177
- - lib/tty/table/padder.rb
178
- - lib/tty/table/renderer.rb
179
- - lib/tty/table/renderer/ascii.rb
180
- - lib/tty/table/renderer/basic.rb
181
- - lib/tty/table/renderer/color.rb
182
- - lib/tty/table/renderer/unicode.rb
183
- - lib/tty/table/row.rb
184
- - lib/tty/table/transformation.rb
185
- - lib/tty/table/validatable.rb
186
166
  - lib/tty/terminal.rb
187
167
  - lib/tty/terminal/echo.rb
188
168
  - lib/tty/terminal/home.rb
@@ -190,10 +170,6 @@ files:
190
170
  - lib/tty/terminal/pager/basic.rb
191
171
  - lib/tty/terminal/pager/system.rb
192
172
  - lib/tty/terminal/raw.rb
193
- - lib/tty/text.rb
194
- - lib/tty/text/distance.rb
195
- - lib/tty/text/truncation.rb
196
- - lib/tty/text/wrapping.rb
197
173
  - lib/tty/vector.rb
198
174
  - lib/tty/version.rb
199
175
  - spec/spec_helper.rb
@@ -205,6 +181,8 @@ files:
205
181
  - spec/tty/plugins/plugin/load_spec.rb
206
182
  - spec/tty/plugins/plugin/new_spec.rb
207
183
  - spec/tty/shell/ask_spec.rb
184
+ - spec/tty/shell/distance/distance_spec.rb
185
+ - spec/tty/shell/distance/initialize_spec.rb
208
186
  - spec/tty/shell/error_spec.rb
209
187
  - spec/tty/shell/print_table_spec.rb
210
188
  - spec/tty/shell/question/argument_spec.rb
@@ -246,103 +224,6 @@ files:
246
224
  - spec/tty/system/platform_spec.rb
247
225
  - spec/tty/system/which/which_spec.rb
248
226
  - spec/tty/system/which_spec.rb
249
- - spec/tty/table/access_spec.rb
250
- - spec/tty/table/add_row_spec.rb
251
- - spec/tty/table/border/ascii/rendering_spec.rb
252
- - spec/tty/table/border/new_spec.rb
253
- - spec/tty/table/border/null/rendering_spec.rb
254
- - spec/tty/table/border/options/from_spec.rb
255
- - spec/tty/table/border/options/new_spec.rb
256
- - spec/tty/table/border/unicode/rendering_spec.rb
257
- - spec/tty/table/border_options/new_spec.rb
258
- - spec/tty/table/border_options/update_spec.rb
259
- - spec/tty/table/column_set/extract_widths_spec.rb
260
- - spec/tty/table/column_set/total_width_spec.rb
261
- - spec/tty/table/column_set/widths_from_spec.rb
262
- - spec/tty/table/columns/enforce_spec.rb
263
- - spec/tty/table/columns/widths_spec.rb
264
- - spec/tty/table/data_spec.rb
265
- - spec/tty/table/each_spec.rb
266
- - spec/tty/table/each_with_index_spec.rb
267
- - spec/tty/table/empty_spec.rb
268
- - spec/tty/table/eql_spec.rb
269
- - spec/tty/table/field/equality_spec.rb
270
- - spec/tty/table/field/length_spec.rb
271
- - spec/tty/table/field/lines_spec.rb
272
- - spec/tty/table/field/new_spec.rb
273
- - spec/tty/table/field/width_spec.rb
274
- - spec/tty/table/filter_spec.rb
275
- - spec/tty/table/header/call_spec.rb
276
- - spec/tty/table/header/height_spec.rb
277
- - spec/tty/table/header/new_spec.rb
278
- - spec/tty/table/header/set_spec.rb
279
- - spec/tty/table/header/to_ary_spec.rb
280
- - spec/tty/table/header_spec.rb
281
- - spec/tty/table/indentation/insert_indent_spec.rb
282
- - spec/tty/table/initialize_spec.rb
283
- - spec/tty/table/operation/alignment/format_spec.rb
284
- - spec/tty/table/operation/alignment/new_spec.rb
285
- - spec/tty/table/operation/alignment_set/call_spec.rb
286
- - spec/tty/table/operation/alignment_set/each_spec.rb
287
- - spec/tty/table/operation/alignment_set/new_spec.rb
288
- - spec/tty/table/operation/alignment_set/to_ary_spec.rb
289
- - spec/tty/table/operation/escape/call_spec.rb
290
- - spec/tty/table/operation/filter/call_spec.rb
291
- - spec/tty/table/operation/truncation/call_spec.rb
292
- - spec/tty/table/operation/truncation/truncate_spec.rb
293
- - spec/tty/table/operation/wrapped/call_spec.rb
294
- - spec/tty/table/operation/wrapped/wrap_spec.rb
295
- - spec/tty/table/operations/new_spec.rb
296
- - spec/tty/table/options_spec.rb
297
- - spec/tty/table/orientation_spec.rb
298
- - spec/tty/table/padder/parse_spec.rb
299
- - spec/tty/table/padder/to_s_spec.rb
300
- - spec/tty/table/padding_spec.rb
301
- - spec/tty/table/properties_spec.rb
302
- - spec/tty/table/render_spec.rb
303
- - spec/tty/table/render_with_spec.rb
304
- - spec/tty/table/renderer/ascii/indentation_spec.rb
305
- - spec/tty/table/renderer/ascii/padding_spec.rb
306
- - spec/tty/table/renderer/ascii/render_spec.rb
307
- - spec/tty/table/renderer/ascii/resizing_spec.rb
308
- - spec/tty/table/renderer/ascii/separator_spec.rb
309
- - spec/tty/table/renderer/basic/alignment_spec.rb
310
- - spec/tty/table/renderer/basic/coloring_spec.rb
311
- - spec/tty/table/renderer/basic/extract_column_widths_spec.rb
312
- - spec/tty/table/renderer/basic/filter_spec.rb
313
- - spec/tty/table/renderer/basic/indentation_spec.rb
314
- - spec/tty/table/renderer/basic/multiline_content_spec.rb
315
- - spec/tty/table/renderer/basic/new_spec.rb
316
- - spec/tty/table/renderer/basic/options_spec.rb
317
- - spec/tty/table/renderer/basic/padding_spec.rb
318
- - spec/tty/table/renderer/basic/render_spec.rb
319
- - spec/tty/table/renderer/basic/resizing_spec.rb
320
- - spec/tty/table/renderer/basic/separator_spec.rb
321
- - spec/tty/table/renderer/basic/truncation_spec.rb
322
- - spec/tty/table/renderer/basic/wrapping_spec.rb
323
- - spec/tty/table/renderer/basic_spec.rb
324
- - spec/tty/table/renderer/border_spec.rb
325
- - spec/tty/table/renderer/render_spec.rb
326
- - spec/tty/table/renderer/select_spec.rb
327
- - spec/tty/table/renderer/style_spec.rb
328
- - spec/tty/table/renderer/unicode/indentation_spec.rb
329
- - spec/tty/table/renderer/unicode/padding_spec.rb
330
- - spec/tty/table/renderer/unicode/render_spec.rb
331
- - spec/tty/table/renderer/unicode/separator_spec.rb
332
- - spec/tty/table/renderer_spec.rb
333
- - spec/tty/table/rotate_spec.rb
334
- - spec/tty/table/row/access_spec.rb
335
- - spec/tty/table/row/call_spec.rb
336
- - spec/tty/table/row/data_spec.rb
337
- - spec/tty/table/row/each_spec.rb
338
- - spec/tty/table/row/equality_spec.rb
339
- - spec/tty/table/row/height_spec.rb
340
- - spec/tty/table/row/new_spec.rb
341
- - spec/tty/table/row/to_ary_spec.rb
342
- - spec/tty/table/to_s_spec.rb
343
- - spec/tty/table/transformation/extract_tuples_spec.rb
344
- - spec/tty/table/validatable/validate_options_spec.rb
345
- - spec/tty/table/validatable_spec.rb
346
227
  - spec/tty/terminal/color_spec.rb
347
228
  - spec/tty/terminal/echo_spec.rb
348
229
  - spec/tty/terminal/home_spec.rb
@@ -353,15 +234,6 @@ files:
353
234
  - spec/tty/terminal/pager/executables_spec.rb
354
235
  - spec/tty/terminal/pager/page_spec.rb
355
236
  - spec/tty/terminal/pager/system/page_spec.rb
356
- - spec/tty/text/distance/distance_spec.rb
357
- - spec/tty/text/distance/initialize_spec.rb
358
- - spec/tty/text/distance_spec.rb
359
- - spec/tty/text/truncate_spec.rb
360
- - spec/tty/text/truncation/initialize_spec.rb
361
- - spec/tty/text/truncation/truncate_spec.rb
362
- - spec/tty/text/wrap_spec.rb
363
- - spec/tty/text/wrapping/initialize_spec.rb
364
- - spec/tty/text/wrapping/wrap_spec.rb
365
237
  - spec/tty/tty_spec.rb
366
238
  - spec/tty/vector/new_spec.rb
367
239
  - tasks/console.rake
@@ -407,6 +279,8 @@ test_files:
407
279
  - spec/tty/plugins/plugin/load_spec.rb
408
280
  - spec/tty/plugins/plugin/new_spec.rb
409
281
  - spec/tty/shell/ask_spec.rb
282
+ - spec/tty/shell/distance/distance_spec.rb
283
+ - spec/tty/shell/distance/initialize_spec.rb
410
284
  - spec/tty/shell/error_spec.rb
411
285
  - spec/tty/shell/print_table_spec.rb
412
286
  - spec/tty/shell/question/argument_spec.rb
@@ -448,103 +322,6 @@ test_files:
448
322
  - spec/tty/system/platform_spec.rb
449
323
  - spec/tty/system/which/which_spec.rb
450
324
  - spec/tty/system/which_spec.rb
451
- - spec/tty/table/access_spec.rb
452
- - spec/tty/table/add_row_spec.rb
453
- - spec/tty/table/border/ascii/rendering_spec.rb
454
- - spec/tty/table/border/new_spec.rb
455
- - spec/tty/table/border/null/rendering_spec.rb
456
- - spec/tty/table/border/options/from_spec.rb
457
- - spec/tty/table/border/options/new_spec.rb
458
- - spec/tty/table/border/unicode/rendering_spec.rb
459
- - spec/tty/table/border_options/new_spec.rb
460
- - spec/tty/table/border_options/update_spec.rb
461
- - spec/tty/table/column_set/extract_widths_spec.rb
462
- - spec/tty/table/column_set/total_width_spec.rb
463
- - spec/tty/table/column_set/widths_from_spec.rb
464
- - spec/tty/table/columns/enforce_spec.rb
465
- - spec/tty/table/columns/widths_spec.rb
466
- - spec/tty/table/data_spec.rb
467
- - spec/tty/table/each_spec.rb
468
- - spec/tty/table/each_with_index_spec.rb
469
- - spec/tty/table/empty_spec.rb
470
- - spec/tty/table/eql_spec.rb
471
- - spec/tty/table/field/equality_spec.rb
472
- - spec/tty/table/field/length_spec.rb
473
- - spec/tty/table/field/lines_spec.rb
474
- - spec/tty/table/field/new_spec.rb
475
- - spec/tty/table/field/width_spec.rb
476
- - spec/tty/table/filter_spec.rb
477
- - spec/tty/table/header/call_spec.rb
478
- - spec/tty/table/header/height_spec.rb
479
- - spec/tty/table/header/new_spec.rb
480
- - spec/tty/table/header/set_spec.rb
481
- - spec/tty/table/header/to_ary_spec.rb
482
- - spec/tty/table/header_spec.rb
483
- - spec/tty/table/indentation/insert_indent_spec.rb
484
- - spec/tty/table/initialize_spec.rb
485
- - spec/tty/table/operation/alignment/format_spec.rb
486
- - spec/tty/table/operation/alignment/new_spec.rb
487
- - spec/tty/table/operation/alignment_set/call_spec.rb
488
- - spec/tty/table/operation/alignment_set/each_spec.rb
489
- - spec/tty/table/operation/alignment_set/new_spec.rb
490
- - spec/tty/table/operation/alignment_set/to_ary_spec.rb
491
- - spec/tty/table/operation/escape/call_spec.rb
492
- - spec/tty/table/operation/filter/call_spec.rb
493
- - spec/tty/table/operation/truncation/call_spec.rb
494
- - spec/tty/table/operation/truncation/truncate_spec.rb
495
- - spec/tty/table/operation/wrapped/call_spec.rb
496
- - spec/tty/table/operation/wrapped/wrap_spec.rb
497
- - spec/tty/table/operations/new_spec.rb
498
- - spec/tty/table/options_spec.rb
499
- - spec/tty/table/orientation_spec.rb
500
- - spec/tty/table/padder/parse_spec.rb
501
- - spec/tty/table/padder/to_s_spec.rb
502
- - spec/tty/table/padding_spec.rb
503
- - spec/tty/table/properties_spec.rb
504
- - spec/tty/table/render_spec.rb
505
- - spec/tty/table/render_with_spec.rb
506
- - spec/tty/table/renderer/ascii/indentation_spec.rb
507
- - spec/tty/table/renderer/ascii/padding_spec.rb
508
- - spec/tty/table/renderer/ascii/render_spec.rb
509
- - spec/tty/table/renderer/ascii/resizing_spec.rb
510
- - spec/tty/table/renderer/ascii/separator_spec.rb
511
- - spec/tty/table/renderer/basic/alignment_spec.rb
512
- - spec/tty/table/renderer/basic/coloring_spec.rb
513
- - spec/tty/table/renderer/basic/extract_column_widths_spec.rb
514
- - spec/tty/table/renderer/basic/filter_spec.rb
515
- - spec/tty/table/renderer/basic/indentation_spec.rb
516
- - spec/tty/table/renderer/basic/multiline_content_spec.rb
517
- - spec/tty/table/renderer/basic/new_spec.rb
518
- - spec/tty/table/renderer/basic/options_spec.rb
519
- - spec/tty/table/renderer/basic/padding_spec.rb
520
- - spec/tty/table/renderer/basic/render_spec.rb
521
- - spec/tty/table/renderer/basic/resizing_spec.rb
522
- - spec/tty/table/renderer/basic/separator_spec.rb
523
- - spec/tty/table/renderer/basic/truncation_spec.rb
524
- - spec/tty/table/renderer/basic/wrapping_spec.rb
525
- - spec/tty/table/renderer/basic_spec.rb
526
- - spec/tty/table/renderer/border_spec.rb
527
- - spec/tty/table/renderer/render_spec.rb
528
- - spec/tty/table/renderer/select_spec.rb
529
- - spec/tty/table/renderer/style_spec.rb
530
- - spec/tty/table/renderer/unicode/indentation_spec.rb
531
- - spec/tty/table/renderer/unicode/padding_spec.rb
532
- - spec/tty/table/renderer/unicode/render_spec.rb
533
- - spec/tty/table/renderer/unicode/separator_spec.rb
534
- - spec/tty/table/renderer_spec.rb
535
- - spec/tty/table/rotate_spec.rb
536
- - spec/tty/table/row/access_spec.rb
537
- - spec/tty/table/row/call_spec.rb
538
- - spec/tty/table/row/data_spec.rb
539
- - spec/tty/table/row/each_spec.rb
540
- - spec/tty/table/row/equality_spec.rb
541
- - spec/tty/table/row/height_spec.rb
542
- - spec/tty/table/row/new_spec.rb
543
- - spec/tty/table/row/to_ary_spec.rb
544
- - spec/tty/table/to_s_spec.rb
545
- - spec/tty/table/transformation/extract_tuples_spec.rb
546
- - spec/tty/table/validatable/validate_options_spec.rb
547
- - spec/tty/table/validatable_spec.rb
548
325
  - spec/tty/terminal/color_spec.rb
549
326
  - spec/tty/terminal/echo_spec.rb
550
327
  - spec/tty/terminal/home_spec.rb
@@ -555,15 +332,6 @@ test_files:
555
332
  - spec/tty/terminal/pager/executables_spec.rb
556
333
  - spec/tty/terminal/pager/page_spec.rb
557
334
  - spec/tty/terminal/pager/system/page_spec.rb
558
- - spec/tty/text/distance/distance_spec.rb
559
- - spec/tty/text/distance/initialize_spec.rb
560
- - spec/tty/text/distance_spec.rb
561
- - spec/tty/text/truncate_spec.rb
562
- - spec/tty/text/truncation/initialize_spec.rb
563
- - spec/tty/text/truncation/truncate_spec.rb
564
- - spec/tty/text/wrap_spec.rb
565
- - spec/tty/text/wrapping/initialize_spec.rb
566
- - spec/tty/text/wrapping/wrap_spec.rb
567
335
  - spec/tty/tty_spec.rb
568
336
  - spec/tty/vector/new_spec.rb
569
337
  has_rdoc:
data/benchmarks/table.rb DELETED
@@ -1,40 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- # Benchmark speed of table operations
4
-
5
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
6
-
7
- require 'tty'
8
- require 'benchmark'
9
- require 'benchmark/ips'
10
-
11
- header = [:name, :color]
12
- rows = (1..100).map { |n| ["row#{n}", "red"] }
13
- table = TTY::Table.new(header, rows)
14
- table_ascii = TTY::Table.new(header, rows, :renderer => :ascii)
15
- table_unicode = TTY::Table.new(header, rows, :renderer => :unicode)
16
- table_color = TTY::Table.new(header, rows, :renderer => :ascii, :border => { :style => :red })
17
-
18
- Benchmark.ips do |r|
19
-
20
- r.report("Ruby #to_s") do
21
- rows.to_s
22
- end
23
-
24
- r.report("TTY #to_s") do
25
- table.to_s
26
- end
27
-
28
- r.report("TTY ASCII #to_s") do
29
- table_ascii.to_s
30
- end
31
-
32
- r.report("TTY Unicode #to_s") do
33
- table_unicode.to_s
34
- end
35
-
36
- r.report("TTY Color #to_s") do
37
- table_color.to_s
38
- end
39
-
40
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module TTY
4
- class Table
5
- class Border
6
- # A class that represents an ascii border.
7
- #
8
- # @api private
9
- class ASCII < Border
10
-
11
- def_border do
12
- top '-'
13
- top_mid '+'
14
- top_left '+'
15
- top_right '+'
16
- bottom '-'
17
- bottom_mid '+'
18
- bottom_left '+'
19
- bottom_right '+'
20
- mid '-'
21
- mid_mid '+'
22
- mid_left '+'
23
- mid_right '+'
24
- left '|'
25
- center '|'
26
- right '|'
27
- end
28
-
29
- end # ASCII
30
- end # Border
31
- end # Table
32
- end # TTY
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module TTY
4
- class Table
5
- class Border
6
- # A class that represents no border.
7
- class Null < Border
8
-
9
- def_border do
10
- center SPACE_CHAR
11
- end
12
-
13
- # A stub top line
14
- #
15
- # @api private
16
- def top_line
17
- border ? super : nil
18
- end
19
-
20
- # A stub separator line
21
- #
22
- # @api private
23
- def separator
24
- return [] if border.separator == EACH_ROW
25
- border ? super : nil
26
- end
27
-
28
- # A stub bottom line
29
- #
30
- # @api private
31
- def bottom_line
32
- border ? super : nil
33
- end
34
- end # Null
35
- end # Border
36
- end # Table
37
- end # TTY