vedeu 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/borders_app.rb +60 -56
- data/lib/vedeu/buffers/all.rb +1 -0
- data/lib/vedeu/configuration/configuration.rb +2 -4
- data/lib/vedeu/cursor/all.rb +3 -6
- data/lib/vedeu/cursor/cursor.rb +4 -3
- data/lib/vedeu/cursor/move_cursor.rb +7 -4
- data/lib/vedeu/cursor/toggle_cursor.rb +0 -1
- data/lib/vedeu/dsl/components/border.rb +99 -0
- data/lib/vedeu/dsl/components/geometry.rb +1 -0
- data/lib/vedeu/dsl/components/keymap.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -12
- data/lib/vedeu/dsl/interface.rb +7 -8
- data/lib/vedeu/dsl/line.rb +1 -10
- data/lib/vedeu/dsl/stream.rb +0 -2
- data/lib/vedeu/input/key.rb +10 -6
- data/lib/vedeu/input/keymap.rb +10 -8
- data/lib/vedeu/models/menu.rb +0 -2
- data/lib/vedeu/models/model.rb +20 -0
- data/lib/vedeu/models/view/composition.rb +4 -17
- data/lib/vedeu/models/view/interface.rb +9 -21
- data/lib/vedeu/models/view/line.rb +4 -17
- data/lib/vedeu/models/view/stream.rb +4 -17
- data/lib/vedeu/output/all.rb +1 -0
- data/lib/vedeu/output/border.rb +2 -2
- data/lib/vedeu/output/compositor.rb +0 -4
- data/lib/vedeu/output/wordwrap.rb +146 -0
- data/lib/vedeu/repositories/repository.rb +3 -2
- data/lib/vedeu/support/console.rb +29 -6
- data/lib/vedeu/support/content_geometry.rb +2 -0
- data/lib/vedeu/support/coordinate.rb +9 -4
- data/lib/vedeu/support/position_validator.rb +28 -7
- data/lib/vedeu/support/sentence.rb +21 -1
- data/lib/vedeu/support/terminal.rb +0 -2
- data/lib/vedeu/support/trace.rb +48 -2
- data/lib/vedeu/support/visible.rb +2 -0
- data/test/lib/vedeu/cursor/all_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +7 -29
- data/test/lib/vedeu/input/key_test.rb +3 -3
- data/test/lib/vedeu/input/keymap_test.rb +3 -3
- data/test/lib/vedeu/output/wordwrap_test.rb +266 -0
- data/test/lib/vedeu/presentation/colour_test.rb +68 -33
- data/test/lib/vedeu/support/common_test.rb +10 -0
- data/test/lib/vedeu/support/console_test.rb +82 -0
- data/test/lib/vedeu/support/position_validator_test.rb +13 -0
- data/test/support/helpers/all.rb +0 -1
- data/vedeu.gemspec +8 -8
- metadata +19 -18
- data/test/support/helpers/misc.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 522afbcf7e2a24c1059b645ad484d1508f665c89
|
4
|
+
data.tar.gz: 33f8e2f388e083fc3f2e18638ced642692047b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03e7507a1f364b8c5c6c236a98a7a48ca5a86ac2985f1f3856af4ba9e314eafa546e3a02c7e861182a665c14d69e290fc8f87496c32da1bdb2718dece6cd8c33
|
7
|
+
data.tar.gz: 96249c16c65ca1b929e2d0b20a1e1330902338fc3cf04fede864918760bbcefc41b511634c14318624ba750a0669b3d6c865ae69891696fd47685c04578208d5
|
data/examples/borders_app.rb
CHANGED
@@ -20,8 +20,6 @@ class VedeuBordersApp
|
|
20
20
|
bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
21
21
|
|
22
22
|
interface 'default_border' do
|
23
|
-
border do
|
24
|
-
end
|
25
23
|
geometry do
|
26
24
|
x 2
|
27
25
|
y 2
|
@@ -38,26 +36,20 @@ class VedeuBordersApp
|
|
38
36
|
height 3
|
39
37
|
width 7
|
40
38
|
end
|
41
|
-
colour foreground: '#ffffff', background: '#
|
39
|
+
colour foreground: '#ffffff', background: '#ff0000'
|
42
40
|
end
|
43
41
|
|
44
42
|
interface 'no_top' do
|
45
|
-
border do
|
46
|
-
show_top false
|
47
|
-
end
|
48
43
|
geometry do
|
49
44
|
x 20
|
50
45
|
y 2
|
51
46
|
height 3
|
52
47
|
width 7
|
53
48
|
end
|
54
|
-
colour foreground: '#
|
49
|
+
colour foreground: '#000000', background: '#ffff00'
|
55
50
|
end
|
56
51
|
|
57
52
|
interface 'no_bottom' do
|
58
|
-
border do
|
59
|
-
show_bottom false
|
60
|
-
end
|
61
53
|
geometry do
|
62
54
|
x 29
|
63
55
|
y 2
|
@@ -68,9 +60,6 @@ class VedeuBordersApp
|
|
68
60
|
end
|
69
61
|
|
70
62
|
interface 'no_left' do
|
71
|
-
border do
|
72
|
-
show_left false
|
73
|
-
end
|
74
63
|
geometry do
|
75
64
|
x 38
|
76
65
|
y 2
|
@@ -81,9 +70,6 @@ class VedeuBordersApp
|
|
81
70
|
end
|
82
71
|
|
83
72
|
interface 'no_right' do
|
84
|
-
border do
|
85
|
-
show_right false
|
86
|
-
end
|
87
73
|
geometry do
|
88
74
|
x 47
|
89
75
|
y 2
|
@@ -94,12 +80,6 @@ class VedeuBordersApp
|
|
94
80
|
end
|
95
81
|
|
96
82
|
interface 'custom_corners' do
|
97
|
-
border do
|
98
|
-
top_right 'B'
|
99
|
-
top_left 'A'
|
100
|
-
bottom_right 'D'
|
101
|
-
bottom_left 'C'
|
102
|
-
end
|
103
83
|
geometry do
|
104
84
|
x 2
|
105
85
|
y 7
|
@@ -110,25 +90,16 @@ class VedeuBordersApp
|
|
110
90
|
end
|
111
91
|
|
112
92
|
interface 'custom_horizontal_and_vertical' do
|
113
|
-
border do
|
114
|
-
horizontal '*'
|
115
|
-
vertical '$'
|
116
|
-
end
|
117
93
|
geometry do
|
118
94
|
x 11
|
119
95
|
y 7
|
120
96
|
height 3
|
121
97
|
width 7
|
122
98
|
end
|
123
|
-
colour foreground: '#ffffff', background: '#
|
99
|
+
colour foreground: '#ffffff', background: '#ff0000'
|
124
100
|
end
|
125
101
|
|
126
102
|
interface 'only_top' do
|
127
|
-
border do
|
128
|
-
show_right false
|
129
|
-
show_bottom false
|
130
|
-
show_left false
|
131
|
-
end
|
132
103
|
geometry do
|
133
104
|
x 20
|
134
105
|
y 7
|
@@ -139,54 +110,36 @@ class VedeuBordersApp
|
|
139
110
|
end
|
140
111
|
|
141
112
|
interface 'only_bottom' do
|
142
|
-
border do
|
143
|
-
show_top false
|
144
|
-
show_right false
|
145
|
-
show_left false
|
146
|
-
end
|
147
113
|
geometry do
|
148
114
|
x 29
|
149
115
|
y 7
|
150
116
|
height 3
|
151
117
|
width 7
|
152
118
|
end
|
153
|
-
colour foreground: '#
|
119
|
+
colour foreground: '#ffffff', background: '#0000ff'
|
154
120
|
end
|
155
121
|
|
156
122
|
interface 'only_left' do
|
157
|
-
border do
|
158
|
-
show_top false
|
159
|
-
show_bottom false
|
160
|
-
show_right false
|
161
|
-
end
|
162
123
|
geometry do
|
163
124
|
x 38
|
164
125
|
y 7
|
165
126
|
height 3
|
166
127
|
width 7
|
167
128
|
end
|
168
|
-
colour foreground: '#
|
129
|
+
colour foreground: '#ffffff', background: '#0000ff'
|
169
130
|
end
|
170
131
|
|
171
132
|
interface 'only_right' do
|
172
|
-
border do
|
173
|
-
show_top false
|
174
|
-
show_bottom false
|
175
|
-
show_left false
|
176
|
-
end
|
177
133
|
geometry do
|
178
134
|
x 47
|
179
135
|
y 7
|
180
136
|
height 3
|
181
137
|
width 7
|
182
138
|
end
|
183
|
-
colour foreground: '#
|
139
|
+
colour foreground: '#ffffff', background: '#0000ff'
|
184
140
|
end
|
185
141
|
|
186
142
|
interface 'custom_colour' do
|
187
|
-
border do
|
188
|
-
colour foreground: '#ffff00', background: '#0000ff'
|
189
|
-
end
|
190
143
|
geometry do
|
191
144
|
x 2
|
192
145
|
y 12
|
@@ -197,9 +150,6 @@ class VedeuBordersApp
|
|
197
150
|
end
|
198
151
|
|
199
152
|
interface 'negative' do
|
200
|
-
border do
|
201
|
-
style 'negative'
|
202
|
-
end
|
203
153
|
geometry do
|
204
154
|
x 11
|
205
155
|
y 12
|
@@ -210,8 +160,14 @@ class VedeuBordersApp
|
|
210
160
|
style 'normal'
|
211
161
|
end
|
212
162
|
|
163
|
+
keymap '_global_' do
|
164
|
+
key('r') { Vedeu.trigger(:_refresh_) }
|
165
|
+
end
|
166
|
+
|
213
167
|
renders do
|
214
168
|
view('default_border') do
|
169
|
+
border do
|
170
|
+
end
|
215
171
|
lines do
|
216
172
|
line 'on'
|
217
173
|
end
|
@@ -222,67 +178,115 @@ class VedeuBordersApp
|
|
222
178
|
end
|
223
179
|
end
|
224
180
|
view('no_top') do
|
181
|
+
border do
|
182
|
+
show_top false
|
183
|
+
end
|
225
184
|
lines do
|
226
185
|
line 'no t'
|
227
186
|
end
|
228
187
|
end
|
229
188
|
view('no_bottom') do
|
189
|
+
border do
|
190
|
+
show_bottom false
|
191
|
+
end
|
230
192
|
lines do
|
231
193
|
line 'no b'
|
232
194
|
end
|
233
195
|
end
|
234
196
|
view('no_left') do
|
197
|
+
border do
|
198
|
+
show_left false
|
199
|
+
end
|
235
200
|
lines do
|
236
201
|
line 'no l'
|
237
202
|
end
|
238
203
|
end
|
239
204
|
view('no_right') do
|
205
|
+
border do
|
206
|
+
show_right false
|
207
|
+
end
|
240
208
|
lines do
|
241
209
|
line 'no r'
|
242
210
|
end
|
243
211
|
end
|
244
212
|
view('custom_corners') do
|
213
|
+
border do
|
214
|
+
top_right 'B'
|
215
|
+
top_left 'A'
|
216
|
+
bottom_right 'D'
|
217
|
+
bottom_left 'C'
|
218
|
+
end
|
245
219
|
lines do
|
246
220
|
line 'chars'
|
247
221
|
line '1'
|
248
222
|
end
|
249
223
|
end
|
250
224
|
view('custom_horizontal_and_vertical') do
|
225
|
+
border do
|
226
|
+
horizontal '*'
|
227
|
+
vertical '$'
|
228
|
+
end
|
251
229
|
lines do
|
252
230
|
line 'chars'
|
253
231
|
line '2'
|
254
232
|
end
|
255
233
|
end
|
256
234
|
view('only_top') do
|
235
|
+
border do
|
236
|
+
show_right false
|
237
|
+
show_bottom false
|
238
|
+
show_left false
|
239
|
+
end
|
257
240
|
lines do
|
258
241
|
line 'only'
|
259
242
|
line 't'
|
260
243
|
end
|
261
244
|
end
|
262
245
|
view('only_bottom') do
|
246
|
+
border do
|
247
|
+
show_top false
|
248
|
+
show_right false
|
249
|
+
show_left false
|
250
|
+
end
|
263
251
|
lines do
|
264
252
|
line 'only'
|
265
253
|
line 'b'
|
266
254
|
end
|
267
255
|
end
|
268
256
|
view('only_left') do
|
257
|
+
border do
|
258
|
+
show_top false
|
259
|
+
show_bottom false
|
260
|
+
show_right false
|
261
|
+
end
|
269
262
|
lines do
|
270
263
|
line 'only'
|
271
264
|
line 'l'
|
272
265
|
end
|
273
266
|
end
|
274
267
|
view('only_right') do
|
268
|
+
border do
|
269
|
+
show_top false
|
270
|
+
show_bottom false
|
271
|
+
show_left false
|
272
|
+
end
|
275
273
|
lines do
|
276
274
|
line 'only'
|
277
275
|
line 'r'
|
278
276
|
end
|
279
277
|
end
|
280
278
|
view('custom_colour') do
|
279
|
+
border do
|
280
|
+
colour foreground: '#ffff00', background: '#0000ff'
|
281
|
+
end
|
281
282
|
lines do
|
282
283
|
line 'color'
|
283
284
|
end
|
284
285
|
end
|
285
286
|
view('negative') do
|
287
|
+
border do
|
288
|
+
style 'negative'
|
289
|
+
end
|
286
290
|
lines do
|
287
291
|
line 'style'
|
288
292
|
end
|
data/lib/vedeu/buffers/all.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
|
3
|
-
require 'vedeu/support/common'
|
4
3
|
require 'vedeu/configuration/api'
|
5
4
|
require 'vedeu/configuration/cli'
|
6
5
|
|
7
6
|
module Vedeu
|
8
7
|
|
9
8
|
# Namespace for the API configuration and CLI configuration classes.
|
10
|
-
#
|
11
9
|
module Config
|
12
10
|
end
|
13
11
|
|
@@ -26,8 +24,6 @@ module Vedeu
|
|
26
24
|
|
27
25
|
class << self
|
28
26
|
|
29
|
-
include Vedeu::Common
|
30
|
-
|
31
27
|
# Configure Vedeu with sensible defaults. If the client application sets
|
32
28
|
# options, override the defaults with those, and if command-line arguments
|
33
29
|
# are provided at application invocation, override any options with the
|
@@ -127,6 +123,8 @@ module Vedeu
|
|
127
123
|
}
|
128
124
|
end
|
129
125
|
|
126
|
+
# @param value []
|
127
|
+
# @return []
|
130
128
|
def options=(value)
|
131
129
|
instance.options = value
|
132
130
|
end
|
data/lib/vedeu/cursor/all.rb
CHANGED
@@ -5,17 +5,14 @@ require 'vedeu/cursor/toggle_cursor'
|
|
5
5
|
|
6
6
|
module Vedeu
|
7
7
|
|
8
|
-
class Cursors < Repository
|
9
|
-
end
|
10
|
-
|
11
8
|
extend self
|
12
9
|
|
13
|
-
# @return [
|
10
|
+
# @return [Vedeu::Repository]
|
14
11
|
def cursors
|
15
|
-
@_cursors ||= Vedeu::
|
12
|
+
@_cursors ||= Vedeu::Repository.new(Vedeu::Cursor)
|
16
13
|
end
|
17
14
|
|
18
|
-
# @return [Cursor|NilClass]
|
15
|
+
# @return [Vedeu::Cursor|NilClass]
|
19
16
|
def cursor
|
20
17
|
cursors.current
|
21
18
|
end
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
@@ -22,12 +22,13 @@ module Vedeu
|
|
22
22
|
# Provides a new instance of Cursor.
|
23
23
|
#
|
24
24
|
# @param attributes [Hash]
|
25
|
-
# @option attributes name [String] The name of the interface this cursor
|
25
|
+
# @option attributes name [String] The name of the interface this cursor
|
26
|
+
# belongs to.
|
26
27
|
# @option attributes ox [Fixnum] The offset x coordinate.
|
27
28
|
# @option attributes oy [Fixnum] The offset y coordinate.
|
28
29
|
# @option attributes repository [Vedeu::Repository]
|
29
|
-
# @option attributes state [Boolean|Symbol] The visibility of the cursor,
|
30
|
-
# or +false+, +:hide+ or +:show+.
|
30
|
+
# @option attributes state [Boolean|Symbol] The visibility of the cursor,
|
31
|
+
# either +true+ or +false+, +:hide+ or +:show+.
|
31
32
|
# @option attributes x [Fixnum] The terminal x coordinate for the cursor.
|
32
33
|
# @option attributes y [Fixnum] The terminal y coordinate for the cursor.
|
33
34
|
#
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'vedeu/cursor/cursor'
|
2
|
+
require 'vedeu/support/coordinate'
|
2
3
|
require 'vedeu/support/position_validator'
|
3
4
|
|
4
5
|
module Vedeu
|
5
6
|
|
6
7
|
# Adjusts the position of the cursor.
|
7
|
-
#
|
8
8
|
class MoveCursor
|
9
9
|
|
10
10
|
extend Forwardable
|
@@ -95,8 +95,8 @@ module Vedeu
|
|
95
95
|
# @return [PositionValidator]
|
96
96
|
def validator
|
97
97
|
@validator ||= Vedeu::PositionValidator.validate(interface,
|
98
|
-
|
99
|
-
|
98
|
+
coordinate.x_position(ox),
|
99
|
+
coordinate.y_position(oy))
|
100
100
|
end
|
101
101
|
|
102
102
|
# @return [Fixnum]
|
@@ -115,7 +115,10 @@ module Vedeu
|
|
115
115
|
|
116
116
|
# @return [Coordinate]
|
117
117
|
def coordinate
|
118
|
-
@coordinate ||= Coordinate.new(bordered_height,
|
118
|
+
@coordinate ||= Vedeu::Coordinate.new(bordered_height,
|
119
|
+
bordered_width,
|
120
|
+
left,
|
121
|
+
top)
|
119
122
|
end
|
120
123
|
|
121
124
|
# @return [Fixnum]
|
@@ -9,6 +9,13 @@ module Vedeu
|
|
9
9
|
# Allows customisation for the border's sides and corners; a custom
|
10
10
|
# foreground and background, style, and whether a particular side should be
|
11
11
|
# drawn or not.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Vedeu.renders do
|
15
|
+
# view 'border_demo' do
|
16
|
+
# border do
|
17
|
+
# # ...
|
18
|
+
#
|
12
19
|
class Border
|
13
20
|
|
14
21
|
include Vedeu::DSL
|
@@ -23,6 +30,16 @@ module Vedeu
|
|
23
30
|
@client = client
|
24
31
|
end
|
25
32
|
|
33
|
+
# Set the character to be used to draw the bottom left corner of the
|
34
|
+
# border.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Vedeu.renders do
|
38
|
+
# view 'border_demo' do
|
39
|
+
# border do
|
40
|
+
# bottom_left '+'
|
41
|
+
# # ...
|
42
|
+
#
|
26
43
|
# @param char [String] Character to be used as the bottom left border
|
27
44
|
# character.
|
28
45
|
# @return [String]
|
@@ -30,6 +47,16 @@ module Vedeu
|
|
30
47
|
model.attributes[:bottom_left] = char
|
31
48
|
end
|
32
49
|
|
50
|
+
# Set the character to be used to draw the bottom right corner of the
|
51
|
+
# border.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Vedeu.renders do
|
55
|
+
# view 'border_demo' do
|
56
|
+
# border do
|
57
|
+
# bottom_right '+'
|
58
|
+
# # ...
|
59
|
+
#
|
33
60
|
# @param char [String] Character to be used as the bottom right border
|
34
61
|
# character.
|
35
62
|
# @return [String]
|
@@ -37,6 +64,15 @@ module Vedeu
|
|
37
64
|
model.attributes[:bottom_right] = char
|
38
65
|
end
|
39
66
|
|
67
|
+
# Set the character to be used to draw a horizontal part of the border.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Vedeu.renders do
|
71
|
+
# view 'border_demo' do
|
72
|
+
# border do
|
73
|
+
# horizontal '-'
|
74
|
+
# # ...
|
75
|
+
#
|
40
76
|
# @param char [String] Character to be used as the horizontal border
|
41
77
|
# character.
|
42
78
|
# @return [String]
|
@@ -44,6 +80,15 @@ module Vedeu
|
|
44
80
|
model.attributes[:horizontal] = char
|
45
81
|
end
|
46
82
|
|
83
|
+
# Enable/disable the bottom border.
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# Vedeu.renders do
|
87
|
+
# view 'border_demo' do
|
88
|
+
# border do
|
89
|
+
# show_bottom false
|
90
|
+
# # ...
|
91
|
+
#
|
47
92
|
# @param boolean [Boolean] All values evaluate as true except nil and
|
48
93
|
# false.
|
49
94
|
# @return [Boolean]
|
@@ -51,6 +96,15 @@ module Vedeu
|
|
51
96
|
model.attributes[:show_bottom] = !!boolean
|
52
97
|
end
|
53
98
|
|
99
|
+
# Enable/disable the left border.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# Vedeu.renders do
|
103
|
+
# view 'border_demo' do
|
104
|
+
# border do
|
105
|
+
# show_left false
|
106
|
+
# # ...
|
107
|
+
#
|
54
108
|
# @param boolean [Boolean] All values evaluate as true except nil and
|
55
109
|
# false.
|
56
110
|
# @return [Boolean]
|
@@ -58,6 +112,15 @@ module Vedeu
|
|
58
112
|
model.attributes[:show_left] = !!boolean
|
59
113
|
end
|
60
114
|
|
115
|
+
# Enable/disable the right border.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# Vedeu.renders do
|
119
|
+
# view 'border_demo' do
|
120
|
+
# border do
|
121
|
+
# show_right false
|
122
|
+
# # ...
|
123
|
+
#
|
61
124
|
# @param boolean [Boolean] All values evaluate as true except nil and
|
62
125
|
# false.
|
63
126
|
# @return [Boolean]
|
@@ -65,6 +128,15 @@ module Vedeu
|
|
65
128
|
model.attributes[:show_right] = !!boolean
|
66
129
|
end
|
67
130
|
|
131
|
+
# Enable/disable the top border.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# Vedeu.renders do
|
135
|
+
# view 'border_demo' do
|
136
|
+
# border do
|
137
|
+
# show_top false
|
138
|
+
# # ...
|
139
|
+
#
|
68
140
|
# @param boolean [Boolean] All values evaluate as true except nil and
|
69
141
|
# false.
|
70
142
|
# @return [Boolean]
|
@@ -72,6 +144,15 @@ module Vedeu
|
|
72
144
|
model.attributes[:show_top] = !!boolean
|
73
145
|
end
|
74
146
|
|
147
|
+
# Set the character to be used to draw the top left corner of the border.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# Vedeu.renders do
|
151
|
+
# view 'border_demo' do
|
152
|
+
# border do
|
153
|
+
# top_left '+'
|
154
|
+
# # ...
|
155
|
+
#
|
75
156
|
# @param char [String] Character to be used as the top left border
|
76
157
|
# character.
|
77
158
|
# @return [String]
|
@@ -79,6 +160,15 @@ module Vedeu
|
|
79
160
|
model.attributes[:top_left] = char
|
80
161
|
end
|
81
162
|
|
163
|
+
# Set the character to be used to draw the top right corner of the border.
|
164
|
+
#
|
165
|
+
# @example
|
166
|
+
# Vedeu.renders do
|
167
|
+
# view 'border_demo' do
|
168
|
+
# border do
|
169
|
+
# top_right '+'
|
170
|
+
# # ...
|
171
|
+
#
|
82
172
|
# @param char [String] Character to be used as the top right border
|
83
173
|
# character.
|
84
174
|
# @return [String]
|
@@ -86,6 +176,15 @@ module Vedeu
|
|
86
176
|
model.attributes[:top_right] = char
|
87
177
|
end
|
88
178
|
|
179
|
+
# Set the character to be used to draw a vertical part of the border.
|
180
|
+
#
|
181
|
+
# @example
|
182
|
+
# Vedeu.renders do
|
183
|
+
# view 'border_demo' do
|
184
|
+
# border do
|
185
|
+
# vertical '|'
|
186
|
+
# # ...
|
187
|
+
#
|
89
188
|
# @param char [String] Character to be used as the vertical border
|
90
189
|
# character.
|
91
190
|
# @return [String]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'vedeu/models/view/interface'
|
2
|
+
|
1
3
|
module Vedeu
|
2
4
|
|
3
5
|
module DSL
|
@@ -34,16 +36,16 @@ module Vedeu
|
|
34
36
|
def view(name = '', &block)
|
35
37
|
fail InvalidSyntax, 'block not given' unless block_given?
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
new_member = if Vedeu.interfaces.registered?(name)
|
40
|
+
existing_member = Vedeu.interfaces.find(name)
|
41
|
+
model.member.build(attributes.merge(existing_member.attributes), &block)
|
40
42
|
|
41
43
|
else
|
42
|
-
|
44
|
+
model.member.build(attributes.merge({ name: name }), &block)
|
43
45
|
|
44
46
|
end
|
45
47
|
|
46
|
-
model.add(
|
48
|
+
model.add(new_member)
|
47
49
|
end
|
48
50
|
|
49
51
|
private
|
@@ -58,13 +60,6 @@ module Vedeu
|
|
58
60
|
}
|
59
61
|
end
|
60
62
|
|
61
|
-
# Return the class name for the children on this model.
|
62
|
-
#
|
63
|
-
# @return [Class]
|
64
|
-
def child
|
65
|
-
Vedeu::Interface
|
66
|
-
end
|
67
|
-
|
68
63
|
end # Composition
|
69
64
|
|
70
65
|
end # DSL
|
data/lib/vedeu/dsl/interface.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
require 'vedeu/cursor/cursor'
|
2
|
+
require 'vedeu/models/focus'
|
3
|
+
require 'vedeu/models/geometry'
|
4
|
+
require 'vedeu/models/group'
|
5
|
+
require 'vedeu/models/view/line'
|
6
|
+
require 'vedeu/output/border'
|
1
7
|
require 'vedeu/support/common'
|
2
8
|
|
3
9
|
module Vedeu
|
@@ -165,7 +171,7 @@ module Vedeu
|
|
165
171
|
def lines(&block)
|
166
172
|
fail InvalidSyntax, 'block not given' unless block_given?
|
167
173
|
|
168
|
-
model.add(
|
174
|
+
model.add(model.member.build(attributes, &block))
|
169
175
|
end
|
170
176
|
alias_method :line, :lines
|
171
177
|
|
@@ -196,13 +202,6 @@ module Vedeu
|
|
196
202
|
}
|
197
203
|
end
|
198
204
|
|
199
|
-
# Return the class name for the children on this model.
|
200
|
-
#
|
201
|
-
# @return [Class]
|
202
|
-
def child
|
203
|
-
Vedeu::Line
|
204
|
-
end
|
205
|
-
|
206
205
|
end # Interface
|
207
206
|
|
208
207
|
end # DSL
|