vedeu 0.0.41 → 0.0.42

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3aaa948386201db5583b301f0ce46662822e87e
4
- data.tar.gz: 7b1660cd10ca3bb5ecac23f2a93a3f0558980708
3
+ metadata.gz: 0a046f5b44b63444927dcb96378474808444b2be
4
+ data.tar.gz: 70e1e365e7727b181d8fbcc813b7843cfc4ce9d3
5
5
  SHA512:
6
- metadata.gz: 8748d5c29561d109b1e2025e661c8778fd0bb5e5ffc09283eef8d9449869063b79bcf70d5e310518920c553218ff3b29a91fe6275c01f223cc58beb86d3411ea
7
- data.tar.gz: 9583f518bf8d5eb588f695e56265c30564f2b7033fb11431ee465f8f5cefd01530b1ffac3618cce6016147a01b657b72ea0a27a9f35fc186b6bd18cd8a8584e6
6
+ metadata.gz: 5265ac3784c962e2405ed0295f66b3b54929272a48745b713c6c8415ecd30763ef29c125f4799ffd84db8063a4d4140dc44e886278ddcc7ad9554e4d9193213f
7
+ data.tar.gz: 8e6a2a56e74dec0fb18f65a3676047a25266be8a7f7302b1bd87df7b8cfbfc72537ca6e88233627985537c20a01db16abb986942f5e89f74d5c72de898bc2ae8
data/deps.md CHANGED
@@ -22,9 +22,6 @@ Colour
22
22
  Composition
23
23
  InterfaceCollection
24
24
 
25
- Compositor
26
- Composition
27
-
28
25
  Configuration
29
26
 
30
27
  Geometry
@@ -74,7 +71,7 @@ LineCollection
74
71
  Menu
75
72
 
76
73
  Parser
77
- Compositor
74
+ Composition
78
75
  HashParser
79
76
  JSONParser
80
77
 
@@ -143,51 +140,50 @@ Launcher
143
140
  Translator
144
141
  Process
145
142
  Parser
146
- Compositor
147
- Composition
148
- InterfaceCollection
149
- Persistence
150
- Interface
151
- ClearInterface
152
- Geometry
143
+ Composition
144
+ InterfaceCollection
145
+ Persistence
146
+ Interface
147
+ ClearInterface
148
+ Geometry
149
+ Esc
150
+ Translator
151
+ Terminal
153
152
  Esc
154
153
  Translator
155
- Terminal
156
- Esc
157
- Translator
158
- LineCollection
159
- Collection
160
- Line
161
- Presentation
162
- Colour
163
- Esc
164
- Translator
165
- StreamCollection
166
- Collection
167
- Stream
168
- Presentation
169
- Colour
170
- Esc
171
- Translator
172
- Style
173
- Esc
174
- Translator
175
- Style
154
+ LineCollection
155
+ Collection
156
+ Line
157
+ Presentation
158
+ Colour
176
159
  Esc
177
160
  Translator
178
- Presentation
179
- Colour
161
+ StreamCollection
162
+ Collection
163
+ Stream
164
+ Presentation
165
+ Colour
166
+ Esc
167
+ Translator
168
+ Style
169
+ Esc
170
+ Translator
171
+ Style
180
172
  Esc
181
173
  Translator
182
- Queue
183
- RenderInterface
184
- ClearInterface
185
- Style
186
- Esc
187
- Translator
188
- Terminal
174
+ Presentation
175
+ Colour
189
176
  Esc
190
177
  Translator
178
+ Queue
179
+ RenderInterface
180
+ ClearInterface
181
+ Style
182
+ Esc
183
+ Translator
184
+ Terminal
185
+ Esc
186
+ Translator
191
187
  HashParser
192
188
  TextAdaptor
193
189
  JSONParser
@@ -9,6 +9,14 @@ module Vedeu
9
9
 
10
10
  attribute :interfaces, InterfaceCollection
11
11
 
12
+ def self.enqueue(attributes)
13
+ new(attributes).enqueue
14
+ end
15
+
16
+ def enqueue
17
+ interfaces.map { |interface| interface.enqueue }
18
+ end
19
+
12
20
  def to_json
13
21
  {
14
22
  interfaces: interfaces
@@ -12,7 +12,7 @@ module Vedeu
12
12
 
13
13
  def render
14
14
  out = [ClearInterface.call(interface)]
15
- interface.lines.each_with_index do |line, index|
15
+ processed_lines.each_with_index do |line, index|
16
16
  out << interface.origin(index)
17
17
  out << line.to_s
18
18
  end
@@ -22,5 +22,38 @@ module Vedeu
22
22
  private
23
23
 
24
24
  attr_reader :interface
25
+
26
+ def processed_lines
27
+ lines.each do |line|
28
+ if line.streams.any?
29
+ processed_streams = []
30
+ line_length = 0
31
+ line.streams.each do |stream|
32
+ next if stream.text.empty?
33
+
34
+ if (line_length += stream.text.size) >= width
35
+ remainder = width - line_length
36
+ stream.text = truncate(stream.text, (remainder - 3))
37
+ end
38
+
39
+ processed_streams << stream
40
+ end
41
+
42
+ line.streams = processed_streams
43
+ end
44
+ end
45
+ end
46
+
47
+ def truncate(text, value)
48
+ text.chomp.slice(0...value)
49
+ end
50
+
51
+ def lines
52
+ interface.lines
53
+ end
54
+
55
+ def width
56
+ interface.width
57
+ end
25
58
  end
26
59
  end
@@ -1,4 +1,4 @@
1
- require 'vedeu/parsing/compositor'
1
+ require 'vedeu/models/composition'
2
2
  require 'vedeu/parsing/hash_parser'
3
3
  require 'vedeu/parsing/json_parser'
4
4
  require 'vedeu/parsing/menu_parser'
@@ -18,7 +18,7 @@ module Vedeu
18
18
  end
19
19
 
20
20
  def parse
21
- Compositor.enqueue(parsed_output)
21
+ Composition.enqueue(parsed_output)
22
22
  end
23
23
 
24
24
  private
@@ -4,6 +4,42 @@ require 'vedeu/support/persistence'
4
4
 
5
5
  module Vedeu
6
6
  describe Composition do
7
+ describe '.enqueue' do
8
+ it 'enqueues the interfaces for rendering' do
9
+ attributes = {
10
+ interfaces: [
11
+ {
12
+ name: 'Composition.enqueue_1',
13
+ width: 35,
14
+ height: 5,
15
+ lines: {
16
+ streams: {
17
+ text: 'bd459118e6175689e4394e242debc2ae'
18
+ }
19
+ }
20
+ }, {
21
+ name: 'Composition.enqueue_2',
22
+ width: 35,
23
+ height: 5,
24
+ lines: {
25
+ streams: {
26
+ text: '837acb2cb2ea3ef359257851142a7830'
27
+ }
28
+ }
29
+ }
30
+ ]
31
+ }
32
+
33
+ Composition.enqueue(attributes)
34
+ Persistence
35
+ .query('Composition.enqueue_1').dequeue
36
+ .must_match(/bd459118e6175689e4394e242debc2ae/)
37
+ Persistence
38
+ .query('Composition.enqueue_2').dequeue
39
+ .must_match(/837acb2cb2ea3ef359257851142a7830/)
40
+ end
41
+ end
42
+
7
43
  describe '#interfaces' do
8
44
  it 'returns a collection of interfaces' do
9
45
  Composition.new({
@@ -42,54 +78,54 @@ module Vedeu
42
78
 
43
79
  describe '#to_s' do
44
80
  it 'returns the stringified content for a single interface, single line, single stream' do
45
- Persistence.create({ name: 'int1_lin1_str1', y: 3, x: 3, width: 10, height: 3 })
81
+ Persistence.create({ name: 'int1_lin1_str1', y: 3, x: 3, width: 15, height: 3 })
46
82
  json = File.read('test/support/json/int1_lin1_str1.json')
47
83
  attributes = JSON.load(json, nil, symbolize_names: true)
48
84
 
49
85
  Composition.new(attributes).to_s.must_equal(
50
- "\e[3;3H \e[3;3H" \
51
- "\e[4;3H \e[4;3H" \
52
- "\e[5;3H \e[5;3H" \
86
+ "\e[3;3H \e[3;3H" \
87
+ "\e[4;3H \e[4;3H" \
88
+ "\e[5;3H \e[5;3H" \
53
89
  "\e[3;3HSome text..."
54
90
  )
55
91
  end
56
92
 
57
93
  it 'returns the stringified content for a single interface, single line, multiple streams' do
58
- Persistence.create({ name: 'int1_lin1_str3', y: 3, x: 3, width: 10, height: 3 })
94
+ Persistence.create({ name: 'int1_lin1_str3', y: 3, x: 3, width: 30, height: 3 })
59
95
  json = File.read('test/support/json/int1_lin1_str3.json')
60
96
  attributes = JSON.load(json, nil, symbolize_names: true)
61
97
 
62
98
  Composition.new(attributes).to_s.must_equal(
63
- "\e[3;3H \e[3;3H" \
64
- "\e[4;3H \e[4;3H" \
65
- "\e[5;3H \e[5;3H" \
99
+ "\e[3;3H \e[3;3H" \
100
+ "\e[4;3H \e[4;3H" \
101
+ "\e[5;3H \e[5;3H" \
66
102
  "\e[3;3HSome text... more text..."
67
103
  )
68
104
  end
69
105
 
70
106
  it 'returns the stringified content for a single interface, multiple lines, single stream' do
71
- Persistence.create({ name: 'int1_lin2_str1', y: 3, x: 3, width: 10, height: 3 })
107
+ Persistence.create({ name: 'int1_lin2_str1', y: 3, x: 3, width: 15, height: 3 })
72
108
  json = File.read('test/support/json/int1_lin2_str1.json')
73
109
  attributes = JSON.load(json, nil, symbolize_names: true)
74
110
 
75
111
  Composition.new(attributes).to_s.must_equal(
76
- "\e[3;3H \e[3;3H" \
77
- "\e[4;3H \e[4;3H" \
78
- "\e[5;3H \e[5;3H" \
112
+ "\e[3;3H \e[3;3H" \
113
+ "\e[4;3H \e[4;3H" \
114
+ "\e[5;3H \e[5;3H" \
79
115
  "\e[3;3HSome text..." \
80
116
  "\e[4;3HSome text..."
81
117
  )
82
118
  end
83
119
 
84
120
  it 'returns the stringified content for a single interface, multiple lines, multiple streams' do
85
- Persistence.create({ name: 'int1_lin2_str3', y: 3, x: 3, width: 10, height: 3 })
121
+ Persistence.create({ name: 'int1_lin2_str3', y: 3, x: 3, width: 30, height: 3 })
86
122
  json = File.read('test/support/json/int1_lin2_str3.json')
87
123
  attributes = JSON.load(json, nil, symbolize_names: true)
88
124
 
89
125
  Composition.new(attributes).to_s.must_equal(
90
- "\e[3;3H \e[3;3H" \
91
- "\e[4;3H \e[4;3H" \
92
- "\e[5;3H \e[5;3H" \
126
+ "\e[3;3H \e[3;3H" \
127
+ "\e[4;3H \e[4;3H" \
128
+ "\e[5;3H \e[5;3H" \
93
129
  "\e[3;3HSome text... more text..." \
94
130
  "\e[4;3HSome text... more text..."
95
131
  )
@@ -98,109 +134,100 @@ module Vedeu
98
134
  it 'returns the stringified content for a single interface, multiple lines, multiple streams, streams contain styles' do
99
135
  json = File.read('test/support/json/int1_lin2_str3_styles.json')
100
136
  attributes = JSON.load(json, nil, symbolize_names: true)
101
- Persistence.create({ name: 'int1_lin2_str3_styles', y: 3, x: 3, width: 10, height: 3 })
137
+ Persistence.create({ name: 'int1_lin2_str3_styles', y: 3, x: 3, width: 30, height: 3 })
102
138
 
103
139
  Composition.new(attributes).to_s.must_equal(
104
- "\e[3;3H \e[3;3H" \
105
- "\e[4;3H \e[4;3H" \
106
- "\e[5;3H \e[5;3H" \
107
- "\e[3;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..."
140
+ "\e[3;3H \e[3;3H" \
141
+ "\e[4;3H \e[4;3H" \
142
+ "\e[5;3H \e[5;3H" \
143
+ "\e[3;3H\e[38;5;16m\e[48;5;21mSome text...\e[38;5;226m\e[48;5;46m \e[38;5;231m\e[48;5;201mmore text..."
108
144
  )
109
145
  end
110
146
 
111
147
  it 'returns the stringified content for multiple interfaces, single line, single stream' do
112
- Persistence.create({ name: 'int2_lin1_str1_1', y: 3, x: 3, width: 10, height: 3 })
113
- Persistence.create({ name: 'int2_lin1_str1_2', y: 6, x: 6, width: 10, height: 3 })
148
+ Persistence.create({ name: 'int2_lin1_str1_1', y: 3, x: 3, width: 15, height: 3 })
149
+ Persistence.create({ name: 'int2_lin1_str1_2', y: 6, x: 6, width: 15, height: 3 })
114
150
  json = File.read('test/support/json/int2_lin1_str1.json')
115
151
  attributes = JSON.load(json, nil, symbolize_names: true)
116
152
 
117
153
  Composition.new(attributes).to_s.must_equal(
118
- "\e[3;3H \e[3;3H" \
119
- "\e[4;3H \e[4;3H" \
120
- "\e[5;3H \e[5;3H" \
154
+ "\e[3;3H \e[3;3H" \
155
+ "\e[4;3H \e[4;3H" \
156
+ "\e[5;3H \e[5;3H" \
121
157
  "\e[3;3HSome text..." \
122
- "\e[6;6H \e[6;6H" \
123
- "\e[7;6H \e[7;6H" \
124
- "\e[8;6H \e[8;6H" \
158
+ "\e[6;6H \e[6;6H" \
159
+ "\e[7;6H \e[7;6H" \
160
+ "\e[8;6H \e[8;6H" \
125
161
  "\e[6;6HSome text..."
126
162
  )
127
163
  end
128
164
 
129
165
  it 'returns the stringified content for multiple interfaces, single line, multiple streams' do
130
- Persistence.create({ name: 'int2_lin1_str3_1', y: 3, x: 3, width: 10, height: 3 })
131
- Persistence.create({ name: 'int2_lin1_str3_2', y: 6, x: 6, width: 10, height: 3 })
166
+ Persistence.create({ name: 'int2_lin1_str3_1', y: 3, x: 3, width: 30, height: 3 })
167
+ Persistence.create({ name: 'int2_lin1_str3_2', y: 6, x: 6, width: 30, height: 3 })
132
168
  json = File.read('test/support/json/int2_lin1_str3.json')
133
169
  attributes = JSON.load(json, nil, symbolize_names: true)
134
170
 
135
171
  Composition.new(attributes).to_s.must_equal(
136
- "\e[3;3H \e[3;3H" \
137
- "\e[4;3H \e[4;3H" \
138
- "\e[5;3H \e[5;3H" \
139
- "\e[3;3HSome text... more text..." \
140
- "\e[6;6H \e[6;6H" \
141
- "\e[7;6H \e[7;6H" \
142
- "\e[8;6H \e[8;6H" \
172
+ "\e[3;3H \e[3;3H" \
173
+ "\e[4;3H \e[4;3H" \
174
+ "\e[5;3H \e[5;3H" \
175
+ "\e[3;3HSome text... more text..." \
176
+ "\e[6;6H \e[6;6H" \
177
+ "\e[7;6H \e[7;6H" \
178
+ "\e[8;6H \e[8;6H" \
143
179
  "\e[6;6HSome text... more text..."
144
180
  )
145
181
  end
146
182
 
147
183
  it 'returns the stringified content for multiple interfaces, multiple lines, single stream' do
148
- Persistence.create({ name: 'int2_lin2_str1_1', y: 3, x: 3, width: 10, height: 3 })
149
- Persistence.create({ name: 'int2_lin2_str1_2', y: 6, x: 6, width: 10, height: 3 })
184
+ Persistence.create({ name: 'int2_lin2_str1_1', y: 3, x: 3, width: 15, height: 3 })
185
+ Persistence.create({ name: 'int2_lin2_str1_2', y: 6, x: 6, width: 15, height: 3 })
150
186
  json = File.read('test/support/json/int2_lin2_str1.json')
151
187
  attributes = JSON.load(json, nil, symbolize_names: true)
152
188
 
153
189
  Composition.new(attributes).to_s.must_equal(
154
- "\e[3;3H \e[3;3H" \
155
- "\e[4;3H \e[4;3H" \
156
- "\e[5;3H \e[5;3H" \
190
+ "\e[3;3H \e[3;3H" \
191
+ "\e[4;3H \e[4;3H" \
192
+ "\e[5;3H \e[5;3H" \
157
193
  "\e[3;3HSome text..." \
158
194
  "\e[4;3HSome text..." \
159
- "\e[3;3H \e[3;3H" \
160
- "\e[4;3H \e[4;3H" \
161
- "\e[5;3H \e[5;3H" \
195
+ "\e[3;3H \e[3;3H" \
196
+ "\e[4;3H \e[4;3H" \
197
+ "\e[5;3H \e[5;3H" \
162
198
  "\e[3;3HSome text..." \
163
199
  "\e[4;3HSome text..."
164
200
  )
165
201
  end
166
202
 
167
203
  it 'returns the stringified content for multiple interfaces, multiple lines, multiple streams' do
168
- Persistence.create({ name: 'int2_lin2_str3_1', y: 3, x: 3, width: 10, height: 3 })
169
- Persistence.create({ name: 'int2_lin2_str3_2', y: 6, x: 6, width: 10, height: 3 })
204
+ Persistence.create({ name: 'int2_lin2_str3_1', y: 3, x: 3, width: 30, height: 3 })
205
+ Persistence.create({ name: 'int2_lin2_str3_2', y: 6, x: 6, width: 30, height: 3 })
170
206
  json = File.read('test/support/json/int2_lin2_str3.json')
171
207
  attributes = JSON.load(json, nil, symbolize_names: true)
172
208
 
173
209
  Composition.new(attributes).to_s.must_equal(
174
- "\e[3;3H \e[3;3H" \
175
- "\e[4;3H \e[4;3H" \
176
- "\e[5;3H \e[5;3H" \
177
- "\e[3;3HSome text... more text..." \
178
- "\e[4;3HSome text... more text..." \
179
- "\e[6;6H \e[6;6H" \
180
- "\e[7;6H \e[7;6H" \
181
- "\e[8;6H \e[8;6H" \
182
- "\e[6;6HSome text... more text..." \
210
+ "\e[3;3H \e[3;3H" \
211
+ "\e[4;3H \e[4;3H" \
212
+ "\e[5;3H \e[5;3H" \
213
+ "\e[3;3HSome text... more text..." \
214
+ "\e[4;3HSome text... more text..." \
215
+ "\e[6;6H \e[6;6H" \
216
+ "\e[7;6H \e[7;6H" \
217
+ "\e[8;6H \e[8;6H" \
218
+ "\e[6;6HSome text... more text..." \
183
219
  "\e[7;6HSome text... more text..."
184
220
  )
185
221
  end
186
222
 
187
223
  it 'returns the stringified content for multiple interfaces, multiple lines, multiple streams, streams contain styles' do
188
- Persistence.create({ name: 'int2_lin2_str3_styles_1', y: 3, x: 3, width: 10, height: 3 })
189
- Persistence.create({ name: 'int2_lin2_str3_styles_2', y: 6, x: 6, width: 10, height: 3 })
224
+ Persistence.create({ name: 'int2_lin2_str3_styles_1', y: 3, x: 3, width: 30, height: 3 })
225
+ Persistence.create({ name: 'int2_lin2_str3_styles_2', y: 6, x: 6, width: 30, height: 3 })
190
226
  json = File.read('test/support/json/int2_lin2_str3_styles.json')
191
227
  attributes = JSON.load(json, nil, symbolize_names: true)
192
228
 
193
229
  Composition.new(attributes).to_s.must_equal(
194
- "\e[3;3H \e[3;3H" \
195
- "\e[4;3H \e[4;3H" \
196
- "\e[5;3H \e[5;3H" \
197
- "\e[3;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
198
- "\e[4;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
199
- "\e[6;6H \e[6;6H" \
200
- "\e[7;6H \e[7;6H" \
201
- "\e[8;6H \e[8;6H" \
202
- "\e[6;6H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
203
- "\e[7;6H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..."
230
+ "\e[3;3H \e[3;3H\e[4;3H \e[4;3H\e[5;3H \e[5;3H\e[3;3H\e[38;5;16m\e[48;5;21mSome text...\e[38;5;226m\e[48;5;46m \e[38;5;231m\e[48;5;201mmore text...\e[4;3H\e[38;5;16m\e[48;5;21mSome text...\e[38;5;226m\e[48;5;46m \e[38;5;231m\e[48;5;201mmore text...\e[6;6H \e[6;6H\e[7;6H \e[7;6H\e[8;6H \e[8;6H\e[6;6H\e[38;5;16m\e[48;5;21mSome text...\e[38;5;226m\e[48;5;46m \e[38;5;231m\e[48;5;201mmore text...\e[7;6H\e[38;5;16m\e[48;5;21mSome text...\e[38;5;226m\e[48;5;46m \e[38;5;231m\e[48;5;201mmore text..."
204
231
  )
205
232
  end
206
233
  end
@@ -68,14 +68,14 @@ module Vedeu
68
68
  Queue.reset
69
69
  interface = Interface.new({
70
70
  name: 'Interface#enqueue',
71
- width: 5,
71
+ width: 8,
72
72
  height: 2,
73
73
  lines: [ { streams: { text: 'a8f39' } } ]
74
74
  })
75
75
  interface.enqueue
76
76
  interface.dequeue.must_equal(
77
- "\e[1;1H \e[1;1H" \
78
- "\e[2;1H \e[2;1H" \
77
+ "\e[1;1H \e[1;1H" \
78
+ "\e[2;1H \e[2;1H" \
79
79
  "\e[1;1Ha8f39"
80
80
  )
81
81
  end
@@ -140,7 +140,7 @@ module Vedeu
140
140
  foreground: '#ff0000',
141
141
  background: '#000000'
142
142
  },
143
- width: 8,
143
+ width: 11,
144
144
  height: 3
145
145
  }
146
146
  interface = Interface.new(attributes)
@@ -149,9 +149,9 @@ module Vedeu
149
149
  Terminal.stub(:output, nil) do
150
150
  interface.refresh.must_equal(
151
151
  "\e[38;5;196m\e[48;5;16m" \
152
- "\e[1;1H \e[1;1H" \
153
- "\e[2;1H \e[2;1H" \
154
- "\e[3;1H \e[3;1H" \
152
+ "\e[1;1H \e[1;1H" \
153
+ "\e[2;1H \e[2;1H" \
154
+ "\e[3;1H \e[3;1H" \
155
155
  "\e[1;1H#refresh" \
156
156
  "\e[2;1H#refresh" \
157
157
  "\e[3;1H#refresh"
@@ -167,14 +167,14 @@ module Vedeu
167
167
  foreground: '#ff0000',
168
168
  background: '#000000'
169
169
  },
170
- width: 8,
170
+ width: 11,
171
171
  height: 3
172
172
  }
173
173
  interface = Interface.new(attributes)
174
174
  interface.current = "\e[38;5;196m\e[48;5;16m" \
175
- "\e[1;1H \e[1;1H" \
176
- "\e[2;1H \e[2;1H" \
177
- "\e[3;1H \e[3;1H" \
175
+ "\e[1;1H \e[1;1H" \
176
+ "\e[2;1H \e[2;1H" \
177
+ "\e[3;1H \e[3;1H" \
178
178
  "\e[1;1H#refresh" \
179
179
  "\e[2;1H#refresh" \
180
180
  "\e[3;1H#refresh"
@@ -182,9 +182,9 @@ module Vedeu
182
182
  Terminal.stub(:output, nil) do
183
183
  interface.refresh.must_equal(
184
184
  "\e[38;5;196m\e[48;5;16m" \
185
- "\e[1;1H \e[1;1H" \
186
- "\e[2;1H \e[2;1H" \
187
- "\e[3;1H \e[3;1H" \
185
+ "\e[1;1H \e[1;1H" \
186
+ "\e[2;1H \e[2;1H" \
187
+ "\e[3;1H \e[3;1H" \
188
188
  "\e[1;1H#refresh" \
189
189
  "\e[2;1H#refresh" \
190
190
  "\e[3;1H#refresh"
@@ -28,13 +28,13 @@ module Vedeu
28
28
  end
29
29
 
30
30
  describe '#to_json' do
31
- it 'returns an String' do
31
+ it 'returns a String' do
32
32
  line.to_json.must_equal("{\"colour\":{\"foreground\":\"#ff0000\",\"background\":\"#000000\"},\"style\":[\"normal\"],\"streams\":[]}")
33
33
  end
34
34
  end
35
35
 
36
36
  describe '#to_s' do
37
- it 'returns an String' do
37
+ it 'returns a String' do
38
38
  line.to_s.must_equal(
39
39
  "\e[38;5;196m\e[48;5;16m" \
40
40
  "\e[24m\e[21m\e[27m"
@@ -12,18 +12,29 @@ module Vedeu
12
12
  interface = Interface.new({
13
13
  name: '.call',
14
14
  width: 32,
15
- height: 2,
15
+ height: 3,
16
16
  lines: 'RenderInterface.call',
17
17
  lines: [
18
- { streams: { text: '1d194f184a0b937c71bfcbdf13511992' } },
19
- { streams: { text: '8787092f681b149d645df64e73d3cb37' } }
18
+ {
19
+ streams: [{ text: 'this is the first' }]
20
+ }, {
21
+ streams: { text: 'this is the second and it is long' }
22
+ }, {
23
+ streams: [
24
+ { text: 'this is the third, ' },
25
+ { text: 'it is even longer ' },
26
+ { text: 'and still truncated' }
27
+ ]
28
+ }
20
29
  ]
21
30
  })
22
31
  RenderInterface.call(interface).must_equal(
23
32
  "\e[1;1H \e[1;1H" \
24
33
  "\e[2;1H \e[2;1H" \
25
- "\e[1;1H1d194f184a0b937c71bfcbdf13511992" \
26
- "\e[2;1H8787092f681b149d645df64e73d3cb37"
34
+ "\e[3;1H \e[3;1H" \
35
+ "\e[1;1Hthis is the first" \
36
+ "\e[2;1Hthis is the second and it is " \
37
+ "\e[3;1Hthis is the third, it is even"
27
38
  )
28
39
  end
29
40
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.0.41'
7
+ spec.version = '0.0.42'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -189,7 +189,6 @@ files:
189
189
  - lib/vedeu/output/clear_interface.rb
190
190
  - lib/vedeu/output/render_interface.rb
191
191
  - lib/vedeu/output/template.rb
192
- - lib/vedeu/parsing/compositor.rb
193
192
  - lib/vedeu/parsing/hash_parser.rb
194
193
  - lib/vedeu/parsing/json_parser.rb
195
194
  - lib/vedeu/parsing/menu_parser.rb
@@ -226,7 +225,6 @@ files:
226
225
  - test/lib/vedeu/output/clear_interface_test.rb
227
226
  - test/lib/vedeu/output/render_interface_test.rb
228
227
  - test/lib/vedeu/output/template.rb
229
- - test/lib/vedeu/parsing/compositor_test.rb
230
228
  - test/lib/vedeu/parsing/hash_parser_test.rb
231
229
  - test/lib/vedeu/parsing/json_parser_test.rb
232
230
  - test/lib/vedeu/parsing/parser_test.rb
@@ -304,7 +302,6 @@ test_files:
304
302
  - test/lib/vedeu/output/clear_interface_test.rb
305
303
  - test/lib/vedeu/output/render_interface_test.rb
306
304
  - test/lib/vedeu/output/template.rb
307
- - test/lib/vedeu/parsing/compositor_test.rb
308
305
  - test/lib/vedeu/parsing/hash_parser_test.rb
309
306
  - test/lib/vedeu/parsing/json_parser_test.rb
310
307
  - test/lib/vedeu/parsing/parser_test.rb
@@ -1,25 +0,0 @@
1
- require 'vedeu/models/composition'
2
-
3
- module Vedeu
4
- class Compositor
5
- def self.enqueue(attributes)
6
- new(attributes).enqueue
7
- end
8
-
9
- def initialize(attributes)
10
- @attributes = attributes
11
- end
12
-
13
- def enqueue
14
- composition.interfaces.map { |interface| interface.enqueue }
15
- end
16
-
17
- private
18
-
19
- attr_reader :attributes
20
-
21
- def composition
22
- @composition ||= Composition.new(attributes)
23
- end
24
- end
25
- end
@@ -1,42 +0,0 @@
1
- require 'test_helper'
2
- require 'vedeu/parsing/compositor'
3
-
4
- module Vedeu
5
- describe Compositor do
6
- describe '.enqueue' do
7
- it 'enqueues the interfaces for rendering' do
8
- attributes = {
9
- interfaces: [
10
- {
11
- name: 'Compositor.enqueue_1',
12
- width: 5,
13
- height: 5,
14
- lines: {
15
- streams: {
16
- text: 'bd459118e6175689e4394e242debc2ae'
17
- }
18
- }
19
- }, {
20
- name: 'Compositor.enqueue_2',
21
- width: 5,
22
- height: 5,
23
- lines: {
24
- streams: {
25
- text: '837acb2cb2ea3ef359257851142a7830'
26
- }
27
- }
28
- }
29
- ]
30
- }
31
-
32
- Compositor.enqueue(attributes)
33
- Persistence
34
- .query('Compositor.enqueue_1').dequeue
35
- .must_match(/bd459118e6175689e4394e242debc2ae/)
36
- Persistence
37
- .query('Compositor.enqueue_2').dequeue
38
- .must_match(/837acb2cb2ea3ef359257851142a7830/)
39
- end
40
- end
41
- end
42
- end