vedeu 0.8.26 → 0.8.27
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/lib/vedeu/dsl/elements.rb +47 -21
- data/lib/vedeu/esc/background.rb +30 -114
- data/lib/vedeu/esc/foreground.rb +30 -114
- data/lib/vedeu/presentation/colour.rb +3 -14
- data/lib/vedeu/presentation/parent.rb +19 -1
- data/lib/vedeu/presentation/styles.rb +7 -13
- data/lib/vedeu/repositories/cache.rb +5 -3
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +0 -9
- data/lib/vedeu/views/line.rb +0 -20
- data/lib/vedeu/views/stream.rb +0 -11
- data/lib/vedeu/views/value.rb +9 -5
- data/lib/vedeu/views/view.rb +0 -20
- data/test/lib/vedeu/presentation/parent_test.rb +41 -1
- data/test/lib/vedeu/presentation/styles_test.rb +14 -0
- data/test/lib/vedeu/views/composition_test.rb +0 -12
- data/test/lib/vedeu/views/line_test.rb +0 -22
- data/test/lib/vedeu/views/stream_test.rb +0 -14
- data/test/lib/vedeu/views/value_test.rb +13 -12
- data/test/lib/vedeu/views/view_test.rb +0 -13
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d982f2ff8445c7766e1ea4f8ebc1686a73bc9e9
|
|
4
|
+
data.tar.gz: ac882d53395e9f4d88493b712cd58c1484132bc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcd158b827af91247492e2c69a452ea941c395202643e06a02e3c17c0f6eaec4a5fb7e81a7a324ef457eb0b70b5ea2cd9f539a83121bdc7edcc7702197d68a71
|
|
7
|
+
data.tar.gz: 278c0088c5c2f06f0dcab500e8598513a80b9ba2814736962d2a7cf348075b883afc2a091e1573583f1cab68f01667b2895186a15c8860933a2d1691f955054a
|
data/lib/vedeu/dsl/elements.rb
CHANGED
|
@@ -68,23 +68,23 @@ module Vedeu
|
|
|
68
68
|
requires_model!
|
|
69
69
|
|
|
70
70
|
attrs = Vedeu::DSL::Attributes.build(self, model, nil, opts, &block)
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
line = build_line(attrs, &block)
|
|
72
|
+
view = build_view(attrs, &block)
|
|
73
73
|
|
|
74
74
|
if view_model?
|
|
75
75
|
if model.lines?
|
|
76
|
-
model.add(
|
|
76
|
+
model.add(line)
|
|
77
77
|
|
|
78
78
|
else
|
|
79
|
-
model.value =
|
|
79
|
+
model.value = view.value
|
|
80
80
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
elsif line_model?
|
|
84
|
-
model.value =
|
|
84
|
+
model.value = line.value
|
|
85
85
|
|
|
86
86
|
else
|
|
87
|
-
model.value =
|
|
87
|
+
model.value = view.value
|
|
88
88
|
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -119,12 +119,12 @@ module Vedeu
|
|
|
119
119
|
attrs = Vedeu::DSL::Attributes.build(self, model, value, opts, &block)
|
|
120
120
|
|
|
121
121
|
l = if block_given?
|
|
122
|
-
|
|
122
|
+
build_line(attrs, &block)
|
|
123
123
|
|
|
124
124
|
else
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Vedeu::Views::Line.new(attrs.merge!(value:
|
|
125
|
+
stream = new_stream(attrs)
|
|
126
|
+
streams = Vedeu::Views::Streams.coerce([stream])
|
|
127
|
+
Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
|
128
128
|
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -155,17 +155,17 @@ module Vedeu
|
|
|
155
155
|
|
|
156
156
|
l = if block_given?
|
|
157
157
|
if view_model?
|
|
158
|
-
|
|
158
|
+
build_line(attrs, &block)
|
|
159
159
|
|
|
160
160
|
else
|
|
161
|
-
|
|
161
|
+
build_stream(attrs, &block)
|
|
162
162
|
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
else
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Vedeu::Views::Line.new(attrs.merge!(value:
|
|
166
|
+
stream = new_stream(attrs)
|
|
167
|
+
streams = Vedeu::Views::Streams.coerce([stream])
|
|
168
|
+
Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
|
169
169
|
|
|
170
170
|
end
|
|
171
171
|
|
|
@@ -241,14 +241,13 @@ module Vedeu
|
|
|
241
241
|
def text(value = '', opts = {})
|
|
242
242
|
requires_model!
|
|
243
243
|
|
|
244
|
-
attrs
|
|
245
|
-
stream
|
|
244
|
+
attrs = Vedeu::DSL::Attributes.build(self, model, value, opts)
|
|
245
|
+
stream = new_stream(attrs)
|
|
246
|
+
streams = Vedeu::Views::Streams.coerce([stream])
|
|
247
|
+
line = Vedeu::Views::Line.new(attrs.merge!(value: streams))
|
|
246
248
|
|
|
247
249
|
if view_model?
|
|
248
|
-
|
|
249
|
-
l = Vedeu::Views::Line.new(attrs.merge!(value: ss))
|
|
250
|
-
|
|
251
|
-
model.add(l)
|
|
250
|
+
model.add(line)
|
|
252
251
|
|
|
253
252
|
elsif line_model?
|
|
254
253
|
model.add(stream)
|
|
@@ -290,6 +289,33 @@ module Vedeu
|
|
|
290
289
|
|
|
291
290
|
private
|
|
292
291
|
|
|
292
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
|
293
|
+
# @macro param_block
|
|
294
|
+
# @return [Vedeu::Views::Line]
|
|
295
|
+
def build_line(attrs, &block)
|
|
296
|
+
Vedeu::Views::Line.build(attrs, &block)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
|
300
|
+
# @macro param_block
|
|
301
|
+
# @return [Vedeu::Views::Stream]
|
|
302
|
+
def build_stream(attrs, &block)
|
|
303
|
+
Vedeu::Views::Stream.build(attrs, &block)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
|
307
|
+
# @macro param_block
|
|
308
|
+
# @return [Vedeu::Views::View]
|
|
309
|
+
def build_view(attrs, &block)
|
|
310
|
+
Vedeu::Views::View.build(attrs, &block)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# @param attrs [Vedeu::DSL::Attributes]
|
|
314
|
+
# @return [Vedeu::Views::Stream]
|
|
315
|
+
def new_stream(attrs)
|
|
316
|
+
Vedeu::Views::Stream.new(attrs)
|
|
317
|
+
end
|
|
318
|
+
|
|
293
319
|
# @macro param_block
|
|
294
320
|
# @macro raise_requires_block
|
|
295
321
|
# @return [NilClass]
|
data/lib/vedeu/esc/background.rb
CHANGED
|
@@ -10,208 +10,124 @@ module Vedeu
|
|
|
10
10
|
# See {file:docs/dsl/by_method/esc.md}
|
|
11
11
|
module Background
|
|
12
12
|
|
|
13
|
+
extend Forwardable
|
|
13
14
|
extend self
|
|
14
15
|
|
|
16
|
+
def_delegators Vedeu::EscapeSequences::Actions, :bg_reset
|
|
17
|
+
|
|
15
18
|
# @macro param_block
|
|
16
19
|
# @return [String]
|
|
17
20
|
def on_black(&block)
|
|
18
|
-
|
|
19
|
-
"\e[40m" + yield + "\e[49m"
|
|
20
|
-
|
|
21
|
-
else
|
|
22
|
-
"\e[40m"
|
|
23
|
-
|
|
24
|
-
end
|
|
21
|
+
background("\e[40m", &block)
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
# @macro param_block
|
|
28
25
|
# @return [String]
|
|
29
26
|
def on_red(&block)
|
|
30
|
-
|
|
31
|
-
"\e[41m" + yield + "\e[49m"
|
|
32
|
-
|
|
33
|
-
else
|
|
34
|
-
"\e[41m"
|
|
35
|
-
|
|
36
|
-
end
|
|
27
|
+
background("\e[41m", &block)
|
|
37
28
|
end
|
|
38
29
|
|
|
39
30
|
# @macro param_block
|
|
40
31
|
# @return [String]
|
|
41
32
|
def on_green(&block)
|
|
42
|
-
|
|
43
|
-
"\e[42m" + yield + "\e[49m"
|
|
44
|
-
|
|
45
|
-
else
|
|
46
|
-
"\e[42m"
|
|
47
|
-
|
|
48
|
-
end
|
|
33
|
+
background("\e[42m", &block)
|
|
49
34
|
end
|
|
50
35
|
|
|
51
36
|
# @macro param_block
|
|
52
37
|
# @return [String]
|
|
53
38
|
def on_yellow(&block)
|
|
54
|
-
|
|
55
|
-
"\e[43m" + yield + "\e[49m"
|
|
56
|
-
|
|
57
|
-
else
|
|
58
|
-
"\e[43m"
|
|
59
|
-
|
|
60
|
-
end
|
|
39
|
+
background("\e[43m", &block)
|
|
61
40
|
end
|
|
62
41
|
|
|
63
42
|
# @macro param_block
|
|
64
43
|
# @return [String]
|
|
65
44
|
def on_blue(&block)
|
|
66
|
-
|
|
67
|
-
"\e[44m" + yield + "\e[49m"
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
"\e[44m"
|
|
71
|
-
|
|
72
|
-
end
|
|
45
|
+
background("\e[44m", &block)
|
|
73
46
|
end
|
|
74
47
|
|
|
75
48
|
# @macro param_block
|
|
76
49
|
# @return [String]
|
|
77
50
|
def on_magenta(&block)
|
|
78
|
-
|
|
79
|
-
"\e[45m" + yield + "\e[49m"
|
|
80
|
-
|
|
81
|
-
else
|
|
82
|
-
"\e[45m"
|
|
83
|
-
|
|
84
|
-
end
|
|
51
|
+
background("\e[45m", &block)
|
|
85
52
|
end
|
|
86
53
|
|
|
87
54
|
# @macro param_block
|
|
88
55
|
# @return [String]
|
|
89
56
|
def on_cyan(&block)
|
|
90
|
-
|
|
91
|
-
"\e[46m" + yield + "\e[49m"
|
|
92
|
-
|
|
93
|
-
else
|
|
94
|
-
"\e[46m"
|
|
95
|
-
|
|
96
|
-
end
|
|
57
|
+
background("\e[46m", &block)
|
|
97
58
|
end
|
|
98
59
|
|
|
99
60
|
# @macro param_block
|
|
100
61
|
# @return [String]
|
|
101
62
|
def on_light_grey(&block)
|
|
102
|
-
|
|
103
|
-
"\e[47m" + yield + "\e[49m"
|
|
104
|
-
|
|
105
|
-
else
|
|
106
|
-
"\e[47m"
|
|
107
|
-
|
|
108
|
-
end
|
|
63
|
+
background("\e[47m", &block)
|
|
109
64
|
end
|
|
110
65
|
|
|
111
66
|
# @macro param_block
|
|
112
67
|
# @return [String]
|
|
113
68
|
def on_default(&block)
|
|
114
|
-
|
|
115
|
-
"\e[49m" + yield + "\e[49m"
|
|
116
|
-
|
|
117
|
-
else
|
|
118
|
-
"\e[49m"
|
|
119
|
-
|
|
120
|
-
end
|
|
69
|
+
background(bg_reset, &block)
|
|
121
70
|
end
|
|
122
71
|
|
|
123
72
|
# @macro param_block
|
|
124
73
|
# @return [String]
|
|
125
74
|
def on_dark_grey(&block)
|
|
126
|
-
|
|
127
|
-
"\e[100m" + yield + "\e[49m"
|
|
128
|
-
|
|
129
|
-
else
|
|
130
|
-
"\e[100m"
|
|
131
|
-
|
|
132
|
-
end
|
|
75
|
+
background("\e[100m", &block)
|
|
133
76
|
end
|
|
134
77
|
|
|
135
78
|
# @macro param_block
|
|
136
79
|
# @return [String]
|
|
137
80
|
def on_light_red(&block)
|
|
138
|
-
|
|
139
|
-
"\e[101m" + yield + "\e[49m"
|
|
140
|
-
|
|
141
|
-
else
|
|
142
|
-
"\e[101m"
|
|
143
|
-
|
|
144
|
-
end
|
|
81
|
+
background("\e[101m", &block)
|
|
145
82
|
end
|
|
146
83
|
|
|
147
84
|
# @macro param_block
|
|
148
85
|
# @return [String]
|
|
149
86
|
def on_light_green(&block)
|
|
150
|
-
|
|
151
|
-
"\e[102m" + yield + "\e[49m"
|
|
152
|
-
|
|
153
|
-
else
|
|
154
|
-
"\e[102m"
|
|
155
|
-
|
|
156
|
-
end
|
|
87
|
+
background("\e[102m", &block)
|
|
157
88
|
end
|
|
158
89
|
|
|
159
90
|
# @macro param_block
|
|
160
91
|
# @return [String]
|
|
161
92
|
def on_light_yellow(&block)
|
|
162
|
-
|
|
163
|
-
"\e[103m" + yield + "\e[49m"
|
|
164
|
-
|
|
165
|
-
else
|
|
166
|
-
"\e[103m"
|
|
167
|
-
|
|
168
|
-
end
|
|
93
|
+
background("\e[103m", &block)
|
|
169
94
|
end
|
|
170
95
|
|
|
171
96
|
# @macro param_block
|
|
172
97
|
# @return [String]
|
|
173
98
|
def on_light_blue(&block)
|
|
174
|
-
|
|
175
|
-
"\e[104m" + yield + "\e[49m"
|
|
176
|
-
|
|
177
|
-
else
|
|
178
|
-
"\e[104m"
|
|
179
|
-
|
|
180
|
-
end
|
|
99
|
+
background("\e[104m", &block)
|
|
181
100
|
end
|
|
182
101
|
|
|
183
102
|
# @macro param_block
|
|
184
103
|
# @return [String]
|
|
185
104
|
def on_light_magenta(&block)
|
|
186
|
-
|
|
187
|
-
"\e[105m" + yield + "\e[49m"
|
|
188
|
-
|
|
189
|
-
else
|
|
190
|
-
"\e[105m"
|
|
191
|
-
|
|
192
|
-
end
|
|
105
|
+
background("\e[105m", &block)
|
|
193
106
|
end
|
|
194
107
|
|
|
195
108
|
# @macro param_block
|
|
196
109
|
# @return [String]
|
|
197
110
|
def on_light_cyan(&block)
|
|
198
|
-
|
|
199
|
-
"\e[106m" + yield + "\e[49m"
|
|
200
|
-
|
|
201
|
-
else
|
|
202
|
-
"\e[106m"
|
|
203
|
-
|
|
204
|
-
end
|
|
111
|
+
background("\e[106m", &block)
|
|
205
112
|
end
|
|
206
113
|
|
|
207
114
|
# @macro param_block
|
|
208
115
|
# @return [String]
|
|
209
116
|
def on_white(&block)
|
|
117
|
+
background("\e[107m", &block)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
|
|
122
|
+
# @param sequence [String] The colour escape sequence.
|
|
123
|
+
# @macro param_block
|
|
124
|
+
# @return [String]
|
|
125
|
+
def background(sequence, &block)
|
|
210
126
|
if block_given?
|
|
211
|
-
|
|
127
|
+
sequence + yield + bg_reset
|
|
212
128
|
|
|
213
129
|
else
|
|
214
|
-
|
|
130
|
+
sequence
|
|
215
131
|
|
|
216
132
|
end
|
|
217
133
|
end
|
data/lib/vedeu/esc/foreground.rb
CHANGED
|
@@ -10,208 +10,124 @@ module Vedeu
|
|
|
10
10
|
# See {file:docs/dsl/by_method/esc.md}
|
|
11
11
|
module Foreground
|
|
12
12
|
|
|
13
|
+
extend Forwardable
|
|
13
14
|
extend self
|
|
14
15
|
|
|
16
|
+
def_delegators Vedeu::EscapeSequences::Actions, :fg_reset
|
|
17
|
+
|
|
15
18
|
# @macro param_block
|
|
16
19
|
# @return [String]
|
|
17
20
|
def black(&block)
|
|
18
|
-
|
|
19
|
-
"\e[30m" + yield + "\e[39m"
|
|
20
|
-
|
|
21
|
-
else
|
|
22
|
-
"\e[30m"
|
|
23
|
-
|
|
24
|
-
end
|
|
21
|
+
foreground("\e[30m", &block)
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
# @macro param_block
|
|
28
25
|
# @return [String]
|
|
29
26
|
def red(&block)
|
|
30
|
-
|
|
31
|
-
"\e[31m" + yield + "\e[39m"
|
|
32
|
-
|
|
33
|
-
else
|
|
34
|
-
"\e[31m"
|
|
35
|
-
|
|
36
|
-
end
|
|
27
|
+
foreground("\e[31m", &block)
|
|
37
28
|
end
|
|
38
29
|
|
|
39
30
|
# @macro param_block
|
|
40
31
|
# @return [String]
|
|
41
32
|
def green(&block)
|
|
42
|
-
|
|
43
|
-
"\e[32m" + yield + "\e[39m"
|
|
44
|
-
|
|
45
|
-
else
|
|
46
|
-
"\e[32m"
|
|
47
|
-
|
|
48
|
-
end
|
|
33
|
+
foreground("\e[32m", &block)
|
|
49
34
|
end
|
|
50
35
|
|
|
51
36
|
# @macro param_block
|
|
52
37
|
# @return [String]
|
|
53
38
|
def yellow(&block)
|
|
54
|
-
|
|
55
|
-
"\e[33m" + yield + "\e[39m"
|
|
56
|
-
|
|
57
|
-
else
|
|
58
|
-
"\e[33m"
|
|
59
|
-
|
|
60
|
-
end
|
|
39
|
+
foreground("\e[33m", &block)
|
|
61
40
|
end
|
|
62
41
|
|
|
63
42
|
# @macro param_block
|
|
64
43
|
# @return [String]
|
|
65
44
|
def blue(&block)
|
|
66
|
-
|
|
67
|
-
"\e[34m" + yield + "\e[39m"
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
"\e[34m"
|
|
71
|
-
|
|
72
|
-
end
|
|
45
|
+
foreground("\e[34m", &block)
|
|
73
46
|
end
|
|
74
47
|
|
|
75
48
|
# @macro param_block
|
|
76
49
|
# @return [String]
|
|
77
50
|
def magenta(&block)
|
|
78
|
-
|
|
79
|
-
"\e[35m" + yield + "\e[39m"
|
|
80
|
-
|
|
81
|
-
else
|
|
82
|
-
"\e[35m"
|
|
83
|
-
|
|
84
|
-
end
|
|
51
|
+
foreground("\e[35m", &block)
|
|
85
52
|
end
|
|
86
53
|
|
|
87
54
|
# @macro param_block
|
|
88
55
|
# @return [String]
|
|
89
56
|
def cyan(&block)
|
|
90
|
-
|
|
91
|
-
"\e[36m" + yield + "\e[39m"
|
|
92
|
-
|
|
93
|
-
else
|
|
94
|
-
"\e[36m"
|
|
95
|
-
|
|
96
|
-
end
|
|
57
|
+
foreground("\e[36m", &block)
|
|
97
58
|
end
|
|
98
59
|
|
|
99
60
|
# @macro param_block
|
|
100
61
|
# @return [String]
|
|
101
62
|
def light_grey(&block)
|
|
102
|
-
|
|
103
|
-
"\e[37m" + yield + "\e[39m"
|
|
104
|
-
|
|
105
|
-
else
|
|
106
|
-
"\e[37m"
|
|
107
|
-
|
|
108
|
-
end
|
|
63
|
+
foreground("\e[37m", &block)
|
|
109
64
|
end
|
|
110
65
|
|
|
111
66
|
# @macro param_block
|
|
112
67
|
# @return [String]
|
|
113
68
|
def default(&block)
|
|
114
|
-
|
|
115
|
-
"\e[39m" + yield + "\e[39m"
|
|
116
|
-
|
|
117
|
-
else
|
|
118
|
-
"\e[39m"
|
|
119
|
-
|
|
120
|
-
end
|
|
69
|
+
foreground("\e[39m", &block)
|
|
121
70
|
end
|
|
122
71
|
|
|
123
72
|
# @macro param_block
|
|
124
73
|
# @return [String]
|
|
125
74
|
def dark_grey(&block)
|
|
126
|
-
|
|
127
|
-
"\e[90m" + yield + "\e[39m"
|
|
128
|
-
|
|
129
|
-
else
|
|
130
|
-
"\e[90m"
|
|
131
|
-
|
|
132
|
-
end
|
|
75
|
+
foreground("\e[90m", &block)
|
|
133
76
|
end
|
|
134
77
|
|
|
135
78
|
# @macro param_block
|
|
136
79
|
# @return [String]
|
|
137
80
|
def light_red(&block)
|
|
138
|
-
|
|
139
|
-
"\e[91m" + yield + "\e[39m"
|
|
140
|
-
|
|
141
|
-
else
|
|
142
|
-
"\e[91m"
|
|
143
|
-
|
|
144
|
-
end
|
|
81
|
+
foreground("\e[91m", &block)
|
|
145
82
|
end
|
|
146
83
|
|
|
147
84
|
# @macro param_block
|
|
148
85
|
# @return [String]
|
|
149
86
|
def light_green(&block)
|
|
150
|
-
|
|
151
|
-
"\e[92m" + yield + "\e[39m"
|
|
152
|
-
|
|
153
|
-
else
|
|
154
|
-
"\e[92m"
|
|
155
|
-
|
|
156
|
-
end
|
|
87
|
+
foreground("\e[92m", &block)
|
|
157
88
|
end
|
|
158
89
|
|
|
159
90
|
# @macro param_block
|
|
160
91
|
# @return [String]
|
|
161
92
|
def light_yellow(&block)
|
|
162
|
-
|
|
163
|
-
"\e[93m" + yield + "\e[39m"
|
|
164
|
-
|
|
165
|
-
else
|
|
166
|
-
"\e[93m"
|
|
167
|
-
|
|
168
|
-
end
|
|
93
|
+
foreground("\e[93m", &block)
|
|
169
94
|
end
|
|
170
95
|
|
|
171
96
|
# @macro param_block
|
|
172
97
|
# @return [String]
|
|
173
98
|
def light_blue(&block)
|
|
174
|
-
|
|
175
|
-
"\e[94m" + yield + "\e[39m"
|
|
176
|
-
|
|
177
|
-
else
|
|
178
|
-
"\e[94m"
|
|
179
|
-
|
|
180
|
-
end
|
|
99
|
+
foreground("\e[94m", &block)
|
|
181
100
|
end
|
|
182
101
|
|
|
183
102
|
# @macro param_block
|
|
184
103
|
# @return [String]
|
|
185
104
|
def light_magenta(&block)
|
|
186
|
-
|
|
187
|
-
"\e[95m" + yield + "\e[39m"
|
|
188
|
-
|
|
189
|
-
else
|
|
190
|
-
"\e[95m"
|
|
191
|
-
|
|
192
|
-
end
|
|
105
|
+
foreground("\e[95m", &block)
|
|
193
106
|
end
|
|
194
107
|
|
|
195
108
|
# @macro param_block
|
|
196
109
|
# @return [String]
|
|
197
110
|
def light_cyan(&block)
|
|
198
|
-
|
|
199
|
-
"\e[96m" + yield + "\e[39m"
|
|
200
|
-
|
|
201
|
-
else
|
|
202
|
-
"\e[96m"
|
|
203
|
-
|
|
204
|
-
end
|
|
111
|
+
foreground("\e[96m", &block)
|
|
205
112
|
end
|
|
206
113
|
|
|
207
114
|
# @macro param_block
|
|
208
115
|
# @return [String]
|
|
209
116
|
def white(&block)
|
|
117
|
+
foreground("\e[97m", &block)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
|
|
122
|
+
# @param sequence [String] The colour escape sequence.
|
|
123
|
+
# @macro param_block
|
|
124
|
+
# @return [String]
|
|
125
|
+
def foreground(sequence, &block)
|
|
210
126
|
if block_given?
|
|
211
|
-
|
|
127
|
+
sequence + yield + fg_reset
|
|
212
128
|
|
|
213
129
|
else
|
|
214
|
-
|
|
130
|
+
sequence
|
|
215
131
|
|
|
216
132
|
end
|
|
217
133
|
end
|
|
@@ -24,7 +24,7 @@ module Vedeu
|
|
|
24
24
|
elsif named_colour?
|
|
25
25
|
named_colour.background
|
|
26
26
|
|
|
27
|
-
elsif parent && present?(parent.background)
|
|
27
|
+
elsif parent? && present?(parent.background)
|
|
28
28
|
parent.background
|
|
29
29
|
|
|
30
30
|
else
|
|
@@ -84,7 +84,7 @@ module Vedeu
|
|
|
84
84
|
elsif named_colour?
|
|
85
85
|
named_colour.foreground
|
|
86
86
|
|
|
87
|
-
elsif parent && present?(parent.foreground)
|
|
87
|
+
elsif parent? && present?(parent.foreground)
|
|
88
88
|
parent.foreground
|
|
89
89
|
|
|
90
90
|
else
|
|
@@ -102,17 +102,6 @@ module Vedeu
|
|
|
102
102
|
@_colour = @colour = colour
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
# @return [NilClass|String|Symbol]
|
|
106
|
-
def name
|
|
107
|
-
if present?(@name)
|
|
108
|
-
@name
|
|
109
|
-
|
|
110
|
-
elsif parent && present?(parent.name)
|
|
111
|
-
parent.name
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
105
|
private
|
|
117
106
|
|
|
118
107
|
# @macro interface_by_name
|
|
@@ -139,7 +128,7 @@ module Vedeu
|
|
|
139
128
|
|
|
140
129
|
# @return [Boolean]
|
|
141
130
|
def parent_colour?
|
|
142
|
-
|
|
131
|
+
parent? && parent.respond_to?(:colour?)
|
|
143
132
|
end
|
|
144
133
|
|
|
145
134
|
# Renders the colour attributes of the receiver and yields (to
|
|
@@ -9,9 +9,27 @@ module Vedeu
|
|
|
9
9
|
#
|
|
10
10
|
module Parent
|
|
11
11
|
|
|
12
|
+
include Vedeu::Common
|
|
13
|
+
|
|
14
|
+
# @return [NilClass|String|Symbol]
|
|
15
|
+
def name
|
|
16
|
+
if present?(@name)
|
|
17
|
+
@name
|
|
18
|
+
|
|
19
|
+
elsif parent? && present?(parent.name)
|
|
20
|
+
parent.name
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
12
25
|
# @return [NilClass|void]
|
|
13
26
|
def parent
|
|
14
|
-
|
|
27
|
+
return @parent if parent?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [Boolean]
|
|
31
|
+
def parent?
|
|
32
|
+
present?(@parent)
|
|
15
33
|
end
|
|
16
34
|
|
|
17
35
|
end # Parent
|
|
@@ -13,27 +13,16 @@ module Vedeu
|
|
|
13
13
|
include Vedeu::Common
|
|
14
14
|
include Vedeu::Presentation::Parent
|
|
15
15
|
|
|
16
|
-
# @return [NilClass|String|Symbol]
|
|
17
|
-
def name
|
|
18
|
-
if present?(@name)
|
|
19
|
-
@name
|
|
20
|
-
|
|
21
|
-
elsif parent && present?(parent.name)
|
|
22
|
-
parent.name
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
16
|
# When the style for the model exists, return it, otherwise
|
|
28
17
|
# returns the parent style, or an empty
|
|
29
18
|
# {Vedeu::Presentation::Style}.
|
|
30
19
|
#
|
|
31
20
|
# @return [Vedeu::Presentation::Style]
|
|
32
21
|
def style
|
|
33
|
-
@_style ||= if
|
|
22
|
+
@_style ||= if style?
|
|
34
23
|
Vedeu::Presentation::Style.coerce(@style)
|
|
35
24
|
|
|
36
|
-
elsif parent && present?(parent.style)
|
|
25
|
+
elsif parent? && present?(parent.style)
|
|
37
26
|
Vedeu::Presentation::Style.coerce(parent.style)
|
|
38
27
|
|
|
39
28
|
else
|
|
@@ -50,6 +39,11 @@ module Vedeu
|
|
|
50
39
|
@_style = @style = Vedeu::Presentation::Style.coerce(value)
|
|
51
40
|
end
|
|
52
41
|
|
|
42
|
+
# @return [Boolean]
|
|
43
|
+
def style?
|
|
44
|
+
present?(@style)
|
|
45
|
+
end
|
|
46
|
+
|
|
53
47
|
private
|
|
54
48
|
|
|
55
49
|
# Renders the style attributes of the receiver and yields (to
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Vedeu
|
|
2
4
|
|
|
3
5
|
module Repositories
|
|
@@ -26,9 +28,9 @@ module Vedeu
|
|
|
26
28
|
|
|
27
29
|
@lock.synchronize do
|
|
28
30
|
@cache[resource] = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
value: value,
|
|
32
|
+
expires_at: (Time.now + expires),
|
|
33
|
+
}
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
36
|
|
data/lib/vedeu/version.rb
CHANGED
|
@@ -43,15 +43,6 @@ module Vedeu
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
# Adds the child to the collection.
|
|
47
|
-
#
|
|
48
|
-
# @param child [Vedeu::Views::View]
|
|
49
|
-
# @return [Vedeu::Views::Views]
|
|
50
|
-
def add(child)
|
|
51
|
-
@value = value.add(child)
|
|
52
|
-
end
|
|
53
|
-
alias << add
|
|
54
|
-
|
|
55
46
|
# @return [Hash<Symbol => void>]
|
|
56
47
|
def attributes
|
|
57
48
|
{
|
data/lib/vedeu/views/line.rb
CHANGED
|
@@ -62,15 +62,6 @@ module Vedeu
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
# Adds the child to the collection.
|
|
66
|
-
#
|
|
67
|
-
# @param child [Vedeu::Views::Stream]
|
|
68
|
-
# @return [Vedeu::Views::Stream]
|
|
69
|
-
def add(child)
|
|
70
|
-
@value = value.add(child)
|
|
71
|
-
end
|
|
72
|
-
alias << add
|
|
73
|
-
|
|
74
65
|
# Returns an array of all the characters with formatting for
|
|
75
66
|
# this line.
|
|
76
67
|
#
|
|
@@ -91,17 +82,6 @@ module Vedeu
|
|
|
91
82
|
end
|
|
92
83
|
alias == eql?
|
|
93
84
|
|
|
94
|
-
# @return [NilClass|String|Symbol]
|
|
95
|
-
def name
|
|
96
|
-
if present?(@name)
|
|
97
|
-
@name
|
|
98
|
-
|
|
99
|
-
elsif parent && present?(parent.name)
|
|
100
|
-
parent.name
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
85
|
# Returns the size of the content in characters without
|
|
106
86
|
# formatting.
|
|
107
87
|
#
|
data/lib/vedeu/views/stream.rb
CHANGED
|
@@ -95,17 +95,6 @@ module Vedeu
|
|
|
95
95
|
end
|
|
96
96
|
alias == eql?
|
|
97
97
|
|
|
98
|
-
# @return [NilClass|String|Symbol]
|
|
99
|
-
def name
|
|
100
|
-
if present?(@name)
|
|
101
|
-
@name
|
|
102
|
-
|
|
103
|
-
elsif parent && present?(parent.name)
|
|
104
|
-
parent.name
|
|
105
|
-
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
98
|
end # Stream
|
|
110
99
|
|
|
111
100
|
end # Views
|
data/lib/vedeu/views/value.rb
CHANGED
|
@@ -73,6 +73,15 @@ module Vedeu
|
|
|
73
73
|
# @return [void]
|
|
74
74
|
attr_accessor :parent
|
|
75
75
|
|
|
76
|
+
# Adds the child to the collection.
|
|
77
|
+
#
|
|
78
|
+
# @param child [Vedeu::Views]
|
|
79
|
+
# @return [Vedeu::Views]
|
|
80
|
+
def add(child)
|
|
81
|
+
@value = value.add(child)
|
|
82
|
+
end
|
|
83
|
+
alias << add
|
|
84
|
+
|
|
76
85
|
# @return [Boolean]
|
|
77
86
|
def client?
|
|
78
87
|
present?(client)
|
|
@@ -96,11 +105,6 @@ module Vedeu
|
|
|
96
105
|
self.class.entity_klass
|
|
97
106
|
end
|
|
98
107
|
|
|
99
|
-
# @return [Boolean]
|
|
100
|
-
def parent?
|
|
101
|
-
present?(parent)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
108
|
# @return [void]
|
|
105
109
|
def value
|
|
106
110
|
collection.coerce(@value || [], self)
|
data/lib/vedeu/views/view.rb
CHANGED
|
@@ -84,15 +84,6 @@ module Vedeu
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
# Adds the child to the collection.
|
|
88
|
-
#
|
|
89
|
-
# @param child [Vedeu::Views::Line]
|
|
90
|
-
# @return [Vedeu::Views::Lines]
|
|
91
|
-
def add(child)
|
|
92
|
-
@value = value.add(child)
|
|
93
|
-
end
|
|
94
|
-
alias << add
|
|
95
|
-
|
|
96
87
|
# @return [Hash]
|
|
97
88
|
def attributes
|
|
98
89
|
{
|
|
@@ -108,17 +99,6 @@ module Vedeu
|
|
|
108
99
|
}
|
|
109
100
|
end
|
|
110
101
|
|
|
111
|
-
# @return [NilClass|String|Symbol]
|
|
112
|
-
def name
|
|
113
|
-
if present?(@name)
|
|
114
|
-
@name
|
|
115
|
-
|
|
116
|
-
elsif parent && present?(parent.name)
|
|
117
|
-
parent.name
|
|
118
|
-
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
102
|
# Store the view in its respective buffer.
|
|
123
103
|
#
|
|
124
104
|
# @param refresh [Boolean] Should the buffer of the view be
|
|
@@ -10,6 +10,7 @@ module Vedeu
|
|
|
10
10
|
|
|
11
11
|
def initialize(attributes = {})
|
|
12
12
|
@colour = attributes[:colour]
|
|
13
|
+
@name = attributes[:name]
|
|
13
14
|
@parent = attributes[:parent]
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -22,16 +23,55 @@ module Vedeu
|
|
|
22
23
|
let(:described) { Vedeu::Presentation::Parent }
|
|
23
24
|
let(:included_described) { Vedeu::PresentationParentTestClass }
|
|
24
25
|
let(:included_instance) { included_described.new(attributes) }
|
|
26
|
+
let(:parent) { Vedeu::PresentationParentTestClass.new }
|
|
27
|
+
let(:_name) { :vedeu_presentation_parent }
|
|
25
28
|
let(:attributes) {
|
|
26
29
|
{
|
|
27
|
-
|
|
30
|
+
name: _name,
|
|
31
|
+
parent: parent,
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
describe '#name' do
|
|
36
|
+
subject { included_instance.name }
|
|
37
|
+
|
|
38
|
+
context 'when a name is set' do
|
|
39
|
+
it { subject.must_equal(_name) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'when a name is not set' do
|
|
43
|
+
let(:_name) {}
|
|
44
|
+
|
|
45
|
+
# context 'when a parent name is set' do
|
|
46
|
+
# it { subject.must_equal('Vedeu::Line') }
|
|
47
|
+
# end
|
|
48
|
+
|
|
49
|
+
context 'when a parent name is not set' do
|
|
50
|
+
let(:parent) {}
|
|
51
|
+
|
|
52
|
+
it { subject.must_equal(nil) }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
31
57
|
describe '#parent' do
|
|
32
58
|
it { included_instance.must_respond_to(:parent) }
|
|
33
59
|
end
|
|
34
60
|
|
|
61
|
+
describe '#parent?' do
|
|
62
|
+
subject { included_instance.parent? }
|
|
63
|
+
|
|
64
|
+
context 'when the parent attribute is set' do
|
|
65
|
+
it { subject.must_equal(true) }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'when the parent attribute is not set' do
|
|
69
|
+
let(:parent) {}
|
|
70
|
+
|
|
71
|
+
it { subject.must_equal(false) }
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
35
75
|
end # Parent
|
|
36
76
|
|
|
37
77
|
end # Presentation
|
|
@@ -84,6 +84,20 @@ module Vedeu
|
|
|
84
84
|
it { subject.must_be_instance_of(Vedeu::Presentation::Style) }
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
describe '#style?' do
|
|
88
|
+
subject { included_instance.style? }
|
|
89
|
+
|
|
90
|
+
context 'when a style is set' do
|
|
91
|
+
it { subject.must_equal(true) }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
context 'when a style is not set' do
|
|
95
|
+
let(:style) {}
|
|
96
|
+
|
|
97
|
+
it { subject.must_equal(false) }
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
87
101
|
end # Styles
|
|
88
102
|
|
|
89
103
|
end # Presentation
|
|
@@ -56,18 +56,6 @@ module Vedeu
|
|
|
56
56
|
it { instance.must_respond_to(:views) }
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
describe '#add' do
|
|
60
|
-
let(:child) { Vedeu::Views::View.new }
|
|
61
|
-
|
|
62
|
-
subject { instance.add(child) }
|
|
63
|
-
|
|
64
|
-
it { subject.must_be_instance_of(Vedeu::Views::Views) }
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe '#<<' do
|
|
68
|
-
it { instance.must_respond_to(:<<) }
|
|
69
|
-
end
|
|
70
|
-
|
|
71
59
|
describe '#attributes' do
|
|
72
60
|
subject { instance.attributes }
|
|
73
61
|
|
|
@@ -70,14 +70,6 @@ module Vedeu
|
|
|
70
70
|
it { instance.must_respond_to(:parent=) }
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
describe '#add' do
|
|
74
|
-
subject { instance.add(child) }
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
describe '#<<' do
|
|
78
|
-
it { instance.must_respond_to(:<<) }
|
|
79
|
-
end
|
|
80
|
-
|
|
81
73
|
describe '#attributes' do
|
|
82
74
|
subject { instance.attributes }
|
|
83
75
|
|
|
@@ -118,20 +110,6 @@ module Vedeu
|
|
|
118
110
|
it { instance.must_respond_to(:==) }
|
|
119
111
|
end
|
|
120
112
|
|
|
121
|
-
describe '#name' do
|
|
122
|
-
subject { instance.name }
|
|
123
|
-
|
|
124
|
-
context 'when a parent is set' do
|
|
125
|
-
it { subject.must_equal('Vedeu::Line') }
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
context 'when a parent is not set' do
|
|
129
|
-
let(:parent) {}
|
|
130
|
-
|
|
131
|
-
it { subject.must_equal(nil) }
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
113
|
describe '#size' do
|
|
136
114
|
subject { instance.size }
|
|
137
115
|
|
|
@@ -103,20 +103,6 @@ module Vedeu
|
|
|
103
103
|
it { instance.must_respond_to(:==) }
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
describe '#name' do
|
|
107
|
-
subject { instance.name }
|
|
108
|
-
|
|
109
|
-
context 'when a parent is set' do
|
|
110
|
-
it { subject.must_equal('Vedeu::Views::Stream') }
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
context 'when a parent is not set' do
|
|
114
|
-
let(:parent) {}
|
|
115
|
-
|
|
116
|
-
it { subject.must_equal(nil) }
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
106
|
end # Stream
|
|
121
107
|
|
|
122
108
|
end # Views
|
|
@@ -40,6 +40,19 @@ module Vedeu
|
|
|
40
40
|
it { included_described.must_respond_to(:parent) }
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
describe '#add' do
|
|
44
|
+
let(:child) {}
|
|
45
|
+
|
|
46
|
+
subject { included_instance.add(child) }
|
|
47
|
+
|
|
48
|
+
# @todo Add more tests.
|
|
49
|
+
# it { skip }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe '#<<' do
|
|
53
|
+
it { included_instance.must_respond_to(:<<) }
|
|
54
|
+
end
|
|
55
|
+
|
|
43
56
|
describe '#client' do
|
|
44
57
|
subject { included_instance.client }
|
|
45
58
|
|
|
@@ -80,18 +93,6 @@ module Vedeu
|
|
|
80
93
|
end
|
|
81
94
|
end
|
|
82
95
|
|
|
83
|
-
describe '#parent?' do
|
|
84
|
-
subject { included_instance.parent? }
|
|
85
|
-
|
|
86
|
-
context 'when the parent attribute is set' do
|
|
87
|
-
# it { subject.must_equal(true) }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
context 'when the parent attribute is not set' do
|
|
91
|
-
it { subject.must_equal(false) }
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
96
|
describe '#value' do
|
|
96
97
|
subject { included_instance.value }
|
|
97
98
|
|
|
@@ -62,10 +62,6 @@ module Vedeu
|
|
|
62
62
|
it { instance.must_respond_to(:cursor_visible=) }
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
describe '#name' do
|
|
66
|
-
it { instance.must_respond_to(:name) }
|
|
67
|
-
end
|
|
68
|
-
|
|
69
65
|
describe '#name=' do
|
|
70
66
|
it { instance.must_respond_to(:name=) }
|
|
71
67
|
end
|
|
@@ -82,15 +78,6 @@ module Vedeu
|
|
|
82
78
|
it { instance.must_respond_to(:zindex=) }
|
|
83
79
|
end
|
|
84
80
|
|
|
85
|
-
describe '#add' do
|
|
86
|
-
let(:child) {}
|
|
87
|
-
|
|
88
|
-
subject { instance.add(child) }
|
|
89
|
-
|
|
90
|
-
# @todo Add more tests.
|
|
91
|
-
# it { skip }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
81
|
describe '#attributes' do
|
|
95
82
|
subject { instance.attributes }
|
|
96
83
|
|
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.8.
|
|
4
|
+
version: 0.8.27
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gavin Laking
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-04-
|
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: guard
|