tty 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/CHANGELOG.md +5 -0
- data/README.md +42 -306
- data/lib/tty/{text → shell}/distance.rb +5 -27
- data/lib/tty/shell/suggestion.rb +42 -22
- data/lib/tty/version.rb +1 -1
- data/lib/tty.rb +2 -42
- data/spec/tty/{text → shell}/distance/distance_spec.rb +4 -4
- data/spec/tty/shell/distance/initialize_spec.rb +14 -0
- data/tty.gemspec +4 -3
- metadata +37 -269
- data/benchmarks/table.rb +0 -40
- data/lib/tty/table/border/ascii.rb +0 -32
- data/lib/tty/table/border/null.rb +0 -37
- data/lib/tty/table/border/row_line.rb +0 -18
- data/lib/tty/table/border/unicode.rb +0 -32
- data/lib/tty/table/border.rb +0 -222
- data/lib/tty/table/border_dsl.rb +0 -251
- data/lib/tty/table/border_options.rb +0 -53
- data/lib/tty/table/column_set.rb +0 -121
- data/lib/tty/table/columns.rb +0 -170
- data/lib/tty/table/error.rb +0 -18
- data/lib/tty/table/field.rb +0 -139
- data/lib/tty/table/header.rb +0 -133
- data/lib/tty/table/indentation.rb +0 -52
- data/lib/tty/table/operation/alignment.rb +0 -107
- data/lib/tty/table/operation/alignment_set.rb +0 -77
- data/lib/tty/table/operation/escape.rb +0 -30
- data/lib/tty/table/operation/filter.rb +0 -34
- data/lib/tty/table/operation/padding.rb +0 -95
- data/lib/tty/table/operation/truncation.rb +0 -55
- data/lib/tty/table/operation/wrapped.rb +0 -58
- data/lib/tty/table/operations.rb +0 -69
- data/lib/tty/table/orientation/horizontal.rb +0 -48
- data/lib/tty/table/orientation/vertical.rb +0 -38
- data/lib/tty/table/orientation.rb +0 -57
- data/lib/tty/table/padder.rb +0 -180
- data/lib/tty/table/renderer/ascii.rb +0 -16
- data/lib/tty/table/renderer/basic.rb +0 -294
- data/lib/tty/table/renderer/color.rb +0 -12
- data/lib/tty/table/renderer/unicode.rb +0 -21
- data/lib/tty/table/renderer.rb +0 -101
- data/lib/tty/table/row.rb +0 -217
- data/lib/tty/table/transformation.rb +0 -39
- data/lib/tty/table/validatable.rb +0 -64
- data/lib/tty/table.rb +0 -476
- data/lib/tty/text/truncation.rb +0 -99
- data/lib/tty/text/wrapping.rb +0 -118
- data/lib/tty/text.rb +0 -98
- data/spec/tty/table/access_spec.rb +0 -86
- data/spec/tty/table/add_row_spec.rb +0 -28
- data/spec/tty/table/border/ascii/rendering_spec.rb +0 -90
- data/spec/tty/table/border/new_spec.rb +0 -27
- data/spec/tty/table/border/null/rendering_spec.rb +0 -130
- data/spec/tty/table/border/options/from_spec.rb +0 -38
- data/spec/tty/table/border/options/new_spec.rb +0 -14
- data/spec/tty/table/border/unicode/rendering_spec.rb +0 -63
- data/spec/tty/table/border_options/new_spec.rb +0 -20
- data/spec/tty/table/border_options/update_spec.rb +0 -18
- data/spec/tty/table/column_set/extract_widths_spec.rb +0 -15
- data/spec/tty/table/column_set/total_width_spec.rb +0 -15
- data/spec/tty/table/column_set/widths_from_spec.rb +0 -51
- data/spec/tty/table/columns/enforce_spec.rb +0 -68
- data/spec/tty/table/columns/widths_spec.rb +0 -35
- data/spec/tty/table/data_spec.rb +0 -14
- data/spec/tty/table/each_spec.rb +0 -41
- data/spec/tty/table/each_with_index_spec.rb +0 -57
- data/spec/tty/table/empty_spec.rb +0 -23
- data/spec/tty/table/eql_spec.rb +0 -34
- data/spec/tty/table/field/equality_spec.rb +0 -51
- data/spec/tty/table/field/length_spec.rb +0 -21
- data/spec/tty/table/field/lines_spec.rb +0 -21
- data/spec/tty/table/field/new_spec.rb +0 -29
- data/spec/tty/table/field/width_spec.rb +0 -23
- data/spec/tty/table/filter_spec.rb +0 -23
- data/spec/tty/table/header/call_spec.rb +0 -30
- data/spec/tty/table/header/height_spec.rb +0 -27
- data/spec/tty/table/header/new_spec.rb +0 -25
- data/spec/tty/table/header/set_spec.rb +0 -20
- data/spec/tty/table/header/to_ary_spec.rb +0 -14
- data/spec/tty/table/header_spec.rb +0 -13
- data/spec/tty/table/indentation/insert_indent_spec.rb +0 -27
- data/spec/tty/table/initialize_spec.rb +0 -88
- data/spec/tty/table/operation/alignment/format_spec.rb +0 -47
- data/spec/tty/table/operation/alignment/new_spec.rb +0 -31
- data/spec/tty/table/operation/alignment_set/call_spec.rb +0 -39
- data/spec/tty/table/operation/alignment_set/each_spec.rb +0 -17
- data/spec/tty/table/operation/alignment_set/new_spec.rb +0 -27
- data/spec/tty/table/operation/alignment_set/to_ary_spec.rb +0 -14
- data/spec/tty/table/operation/escape/call_spec.rb +0 -16
- data/spec/tty/table/operation/filter/call_spec.rb +0 -17
- data/spec/tty/table/operation/truncation/call_spec.rb +0 -32
- data/spec/tty/table/operation/truncation/truncate_spec.rb +0 -22
- data/spec/tty/table/operation/wrapped/call_spec.rb +0 -33
- data/spec/tty/table/operation/wrapped/wrap_spec.rb +0 -23
- data/spec/tty/table/operations/new_spec.rb +0 -30
- data/spec/tty/table/options_spec.rb +0 -25
- data/spec/tty/table/orientation_spec.rb +0 -145
- data/spec/tty/table/padder/parse_spec.rb +0 -45
- data/spec/tty/table/padder/to_s_spec.rb +0 -14
- data/spec/tty/table/padding_spec.rb +0 -120
- data/spec/tty/table/properties_spec.rb +0 -25
- data/spec/tty/table/render_spec.rb +0 -63
- data/spec/tty/table/render_with_spec.rb +0 -106
- data/spec/tty/table/renderer/ascii/indentation_spec.rb +0 -41
- data/spec/tty/table/renderer/ascii/padding_spec.rb +0 -61
- data/spec/tty/table/renderer/ascii/render_spec.rb +0 -68
- data/spec/tty/table/renderer/ascii/resizing_spec.rb +0 -114
- data/spec/tty/table/renderer/ascii/separator_spec.rb +0 -28
- data/spec/tty/table/renderer/basic/alignment_spec.rb +0 -88
- data/spec/tty/table/renderer/basic/coloring_spec.rb +0 -46
- data/spec/tty/table/renderer/basic/extract_column_widths_spec.rb +0 -28
- data/spec/tty/table/renderer/basic/filter_spec.rb +0 -53
- data/spec/tty/table/renderer/basic/indentation_spec.rb +0 -48
- data/spec/tty/table/renderer/basic/multiline_content_spec.rb +0 -135
- data/spec/tty/table/renderer/basic/new_spec.rb +0 -22
- data/spec/tty/table/renderer/basic/options_spec.rb +0 -48
- data/spec/tty/table/renderer/basic/padding_spec.rb +0 -52
- data/spec/tty/table/renderer/basic/render_spec.rb +0 -57
- data/spec/tty/table/renderer/basic/resizing_spec.rb +0 -96
- data/spec/tty/table/renderer/basic/separator_spec.rb +0 -43
- data/spec/tty/table/renderer/basic/truncation_spec.rb +0 -35
- data/spec/tty/table/renderer/basic/wrapping_spec.rb +0 -40
- data/spec/tty/table/renderer/basic_spec.rb +0 -0
- data/spec/tty/table/renderer/border_spec.rb +0 -104
- data/spec/tty/table/renderer/render_spec.rb +0 -36
- data/spec/tty/table/renderer/select_spec.rb +0 -22
- data/spec/tty/table/renderer/style_spec.rb +0 -72
- data/spec/tty/table/renderer/unicode/indentation_spec.rb +0 -41
- data/spec/tty/table/renderer/unicode/padding_spec.rb +0 -61
- data/spec/tty/table/renderer/unicode/render_spec.rb +0 -68
- data/spec/tty/table/renderer/unicode/separator_spec.rb +0 -26
- data/spec/tty/table/renderer_spec.rb +0 -19
- data/spec/tty/table/rotate_spec.rb +0 -86
- data/spec/tty/table/row/access_spec.rb +0 -25
- data/spec/tty/table/row/call_spec.rb +0 -41
- data/spec/tty/table/row/data_spec.rb +0 -26
- data/spec/tty/table/row/each_spec.rb +0 -31
- data/spec/tty/table/row/equality_spec.rb +0 -73
- data/spec/tty/table/row/height_spec.rb +0 -27
- data/spec/tty/table/row/new_spec.rb +0 -41
- data/spec/tty/table/row/to_ary_spec.rb +0 -14
- data/spec/tty/table/to_s_spec.rb +0 -63
- data/spec/tty/table/transformation/extract_tuples_spec.rb +0 -35
- data/spec/tty/table/validatable/validate_options_spec.rb +0 -33
- data/spec/tty/table/validatable_spec.rb +0 -32
- data/spec/tty/text/distance/initialize_spec.rb +0 -14
- data/spec/tty/text/distance_spec.rb +0 -11
- data/spec/tty/text/truncate_spec.rb +0 -12
- data/spec/tty/text/truncation/initialize_spec.rb +0 -29
- data/spec/tty/text/truncation/truncate_spec.rb +0 -94
- data/spec/tty/text/wrap_spec.rb +0 -13
- data/spec/tty/text/wrapping/initialize_spec.rb +0 -25
- data/spec/tty/text/wrapping/wrap_spec.rb +0 -97
@@ -1,97 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe TTY::Text::Wrapping, '#wrap' do
|
6
|
-
let(:object) { described_class.new(text, options) }
|
7
|
-
let(:indent) { 0 }
|
8
|
-
let(:padding) { [] }
|
9
|
-
let(:options) { {length: length, indent: indent, padding: padding} }
|
10
|
-
|
11
|
-
subject(:wrapping) { object.wrap }
|
12
|
-
|
13
|
-
context 'unicode support' do
|
14
|
-
let(:text) { 'ラドクリフ、マラソン五輪代表に1万m出場にも含み' }
|
15
|
-
|
16
|
-
context 'with zero length' do
|
17
|
-
let(:length) { 0 }
|
18
|
-
|
19
|
-
it { is_expected.to eq(text) }
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'with nil length' do
|
23
|
-
let(:length) { nil }
|
24
|
-
|
25
|
-
it { is_expected.to eq(text) }
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'without wrapping' do
|
29
|
-
let(:length) { 8 }
|
30
|
-
|
31
|
-
it { is_expected.to eq("ラドクリフ、マラ\nソン五輪代表に1\n万m出場にも含み") }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with wrapping' do
|
35
|
-
let(:length) { 100 }
|
36
|
-
|
37
|
-
it { is_expected.to eq(text) }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'ascii long text' do
|
42
|
-
let(:length) { 45 }
|
43
|
-
let(:text) { "What of it, if some old hunks of a sea-captain orders me to get a broom
|
44
|
-
and sweep down the decks? What does that indignity amount to, weighed,
|
45
|
-
I mean, in the scales of the New Testament? Do you think the archangel
|
46
|
-
Gabriel thinks anything the less of me, because I promptly and
|
47
|
-
respectfully obey that old hunks in that particular instance? Who ain't
|
48
|
-
a slave? Tell me that. Well, then, however the old sea-captains may
|
49
|
-
order me about--however they may thump and punch me about, I have the
|
50
|
-
satisfaction of knowing that it is all right;
|
51
|
-
" }
|
52
|
-
|
53
|
-
it { is_expected.to eq <<-EOS.normalize
|
54
|
-
What of it, if some old hunks of a\n sea-captain orders me to get a broom
|
55
|
-
and sweep down the decks? What does that\n indignity amount to, weighed,
|
56
|
-
I mean, in the scales of the New Testament?\n Do you think the archangel
|
57
|
-
Gabriel thinks anything the less of me,\n because I promptly and
|
58
|
-
respectfully obey that old hunks in that\nparticular instance? Who ain't
|
59
|
-
a slave? Tell me that. Well, then, however\n the old sea-captains may
|
60
|
-
order me about--however they may thump and\n punch me about, I have the
|
61
|
-
satisfaction of knowing that it is all right;\n
|
62
|
-
EOS
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'with indent' do
|
67
|
-
let(:text) { 'ラドクリフ、マラソン五輪代表に1万m出場にも含み' }
|
68
|
-
let(:length) { 8 }
|
69
|
-
let(:indent) { 4 }
|
70
|
-
|
71
|
-
it { is_expected.to eq " ラドクリフ、マラ\n ソン五輪代表に1\n 万m出場にも含み" }
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'with ansi colors' do
|
75
|
-
let(:text) { "\[\033[01;32m\]Hey have\[\033[01;34m\]some cake\[\033[00m\]" }
|
76
|
-
let(:length) { 6 }
|
77
|
-
|
78
|
-
it { is_expected.to eq "\[\033[01;32m\]Hey have\[\033[01;34m\]some\ncake\[\033[00m\]" }
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'with newlines' do
|
82
|
-
context 'with both prefix and postfix' do
|
83
|
-
let(:text) { "\n\nラドクリフ、マラソン五輪代表に1万m出場にも含み\n\n\n" }
|
84
|
-
let(:length) { 10 }
|
85
|
-
|
86
|
-
it { is_expected.to eq "\n\nラドクリフ、マラソン\n五輪代表に1万m出場\nにも含み\n\n\n" }
|
87
|
-
end
|
88
|
-
|
89
|
-
context 'with padding' do
|
90
|
-
let(:text) { "\n\nラドクリフ、マラソン五輪代表に1万m出場にも含み\n\n" }
|
91
|
-
let(:length) { 10 }
|
92
|
-
let(:padding) { [1,2,3,4] }
|
93
|
-
|
94
|
-
it { is_expected.to eq "\n\n ラドクリフ、マラソン \n 五輪代表に1万m出場 \n にも含み \n\n" }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end # wrap
|