vedeu 0.6.47 → 0.6.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/borders/border.rb +12 -0
- data/lib/vedeu/configuration/api.rb +3 -3
- data/lib/vedeu/editor/delete.rb +26 -9
- data/lib/vedeu/editor/document.rb +45 -50
- data/lib/vedeu/editor/line.rb +0 -2
- data/lib/vedeu/editor/lines.rb +0 -2
- data/lib/vedeu/events/event.rb +1 -1
- data/lib/vedeu/geometry/dimension.rb +4 -4
- data/lib/vedeu/geometry/geometry.rb +13 -0
- data/lib/vedeu/geometry/x_dimension.rb +2 -10
- data/lib/vedeu/geometry/y_dimension.rb +2 -10
- data/lib/vedeu/groups/group.rb +12 -0
- data/lib/vedeu/input/keymap.rb +12 -0
- data/lib/vedeu/interfaces/clear.rb +43 -36
- data/lib/vedeu/interfaces/interface.rb +13 -0
- data/lib/vedeu/logging/ips.rb +2 -2
- data/lib/vedeu/menus/menu.rb +12 -0
- data/lib/vedeu/models/views/composition.rb +13 -0
- data/lib/vedeu/models/views/html_char.rb +1 -1
- data/lib/vedeu/models/views/line.rb +13 -1
- data/lib/vedeu/models/views/stream.rb +12 -0
- data/lib/vedeu/models/views/view.rb +12 -0
- data/lib/vedeu/output/renderers/all.rb +2 -2
- data/lib/vedeu/output/renderers/html.rb +1 -1
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/repositories/model.rb +0 -32
- data/lib/vedeu/runtime/launcher.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +8 -0
- data/test/lib/vedeu/editor/delete_test.rb +2 -2
- data/test/lib/vedeu/editor/document_test.rb +19 -37
- data/test/lib/vedeu/geometry/geometry_test.rb +8 -0
- data/test/lib/vedeu/groups/group_test.rb +8 -0
- data/test/lib/vedeu/input/keymap_test.rb +8 -0
- data/test/lib/vedeu/interfaces/interface_test.rb +8 -0
- data/test/lib/vedeu/menus/menu_test.rb +8 -0
- data/test/lib/vedeu/models/views/composition_test.rb +7 -0
- data/test/lib/vedeu/models/views/line_test.rb +8 -0
- data/test/lib/vedeu/models/views/stream_test.rb +8 -0
- data/test/lib/vedeu/models/views/view_test.rb +8 -0
- data/test/lib/vedeu/repositories/model_test.rb +0 -8
- data/test/test_helper.rb +1 -1
- 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: 9759381f1db665ae94ab60090c238d752bbdc117
|
4
|
+
data.tar.gz: ac4f61ccd7ed1156dc851b590afe18d957ec2b97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20aa205043bf1c5563dd7814f26fc3edd2c26dc3b4edfd65ba85534a3e9294f38c682f1dcd662add1152d93ff3358544679c0bd8db784f54ba7aa59fff0ec1d0
|
7
|
+
data.tar.gz: d0ed14b86e102240df0609974d09dc6530c6e75cfc0dd86afa17b892ad19074427ac9b24459b9a3209c2d7792ff888b70732ee9a4edad8c92de8401575d93966
|
data/lib/vedeu/borders/border.rb
CHANGED
@@ -204,6 +204,18 @@ module Vedeu
|
|
204
204
|
(enabled? && bottom?) ? yn - 1 : yn
|
205
205
|
end
|
206
206
|
|
207
|
+
# Returns a DSL instance responsible for defining the DSL
|
208
|
+
# methods of this model.
|
209
|
+
#
|
210
|
+
# @param client [Object|NilClass] The client binding represents
|
211
|
+
# the client application object that is currently invoking a
|
212
|
+
# DSL method. It is required so that we can send messages to
|
213
|
+
# the client application object should we need to.
|
214
|
+
# @return [Vedeu::Borders::DSL] The DSL instance for this model.
|
215
|
+
def deputy(client = nil)
|
216
|
+
Vedeu::Borders::DSL.new(self, client)
|
217
|
+
end
|
218
|
+
|
207
219
|
# Returns the width of the interface determined by whether a
|
208
220
|
# left, right, both or neither borders are shown.
|
209
221
|
#
|
@@ -557,10 +557,10 @@ module Vedeu
|
|
557
557
|
|
558
558
|
private
|
559
559
|
|
560
|
-
# @
|
560
|
+
# @param attrs [Hash<Symbol => Vedeu::Colours::Background,
|
561
561
|
# Vedeu::Colours::Foreground>]
|
562
|
-
# @
|
563
|
-
# @
|
562
|
+
# @option attrs background [Vedeu::Colours::Background]
|
563
|
+
# @option attrs foreground [Vedeu::Colours::Foreground]
|
564
564
|
# @return [Hash<Symbol => Symbol>]
|
565
565
|
def colour_attributes(attrs = {})
|
566
566
|
{
|
data/lib/vedeu/editor/delete.rb
CHANGED
@@ -26,15 +26,10 @@ module Vedeu
|
|
26
26
|
|
27
27
|
# @return [Vedeu::Editor::Line|Vedeu::Editor::Lines]
|
28
28
|
def delete
|
29
|
+
return collection if collection.empty? || negative_index?
|
29
30
|
return collection.dup.tap { |c| c.slice!(index) } if index
|
30
|
-
|
31
|
-
|
32
|
-
collection.dup.tap(&:pop)
|
33
|
-
|
34
|
-
elsif collection.is_a?(String)
|
35
|
-
collection.chop
|
36
|
-
|
37
|
-
end
|
31
|
+
return collection.dup.tap(&:pop) if lines?
|
32
|
+
return collection.chop if line?
|
38
33
|
end
|
39
34
|
|
40
35
|
protected
|
@@ -53,11 +48,33 @@ module Vedeu
|
|
53
48
|
def index
|
54
49
|
return nil unless @index
|
55
50
|
|
56
|
-
@index = 0 if @index < 0
|
57
51
|
@index = size - 1 if @index > size
|
58
52
|
@index
|
59
53
|
end
|
60
54
|
|
55
|
+
# If true, we are dealing with a {Vedeu::Editor::Line} object.
|
56
|
+
#
|
57
|
+
# @return [Boolean]
|
58
|
+
def line?
|
59
|
+
collection.is_a?(String)
|
60
|
+
end
|
61
|
+
|
62
|
+
# If true, we are dealing with a {Vedeu::Editor::Lines}
|
63
|
+
# collection.
|
64
|
+
#
|
65
|
+
# @return [Boolean]
|
66
|
+
def lines?
|
67
|
+
collection.is_a?(Array)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Returns a boolean indicating whether the index was given or
|
71
|
+
# negative.
|
72
|
+
#
|
73
|
+
# @return [Boolean]
|
74
|
+
def negative_index?
|
75
|
+
index && index < 0
|
76
|
+
end
|
77
|
+
|
61
78
|
end # Delete
|
62
79
|
|
63
80
|
end # Editor
|
@@ -49,15 +49,30 @@ module Vedeu
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
# Returns the document as a string with line breaks if there is
|
53
|
+
# more than one line.
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
def execute
|
57
|
+
command = lines.map(&:to_s).join("\n".freeze)
|
58
|
+
|
59
|
+
reset!
|
60
|
+
|
61
|
+
Vedeu.trigger(:_clear_view_content_, name)
|
62
|
+
|
63
|
+
Vedeu.trigger(:_command_, command)
|
64
|
+
|
65
|
+
command
|
66
|
+
end
|
67
|
+
|
52
68
|
# Deletes the character from the line where the cursor is
|
53
69
|
# currently positioned.
|
54
70
|
#
|
55
71
|
# @return [Vedeu::Editor::Document]
|
56
72
|
def delete_character
|
57
|
-
if x - 1 < 0 && y == 0
|
58
|
-
bol
|
73
|
+
return self if (x == 0 || x - 1 < 0) && y == 0
|
59
74
|
|
60
|
-
|
75
|
+
if (x == 0 || x - 1 < 0) && y > 0
|
61
76
|
delete_line
|
62
77
|
|
63
78
|
return
|
@@ -80,25 +95,11 @@ module Vedeu
|
|
80
95
|
|
81
96
|
up
|
82
97
|
|
83
|
-
|
84
|
-
|
85
|
-
refresh
|
86
|
-
end
|
87
|
-
|
88
|
-
# Returns the document as a string with line breaks if there is
|
89
|
-
# more than one line.
|
90
|
-
#
|
91
|
-
# @return [String]
|
92
|
-
def execute
|
93
|
-
command = lines.map(&:to_s).join("\n")
|
94
|
-
|
95
|
-
reset!
|
96
|
-
|
97
|
-
Vedeu.trigger(:_clear_view_content_, name)
|
98
|
+
cursor.x = line.size
|
98
99
|
|
99
|
-
|
100
|
+
cursor.refresh
|
100
101
|
|
101
|
-
|
102
|
+
refresh
|
102
103
|
end
|
103
104
|
|
104
105
|
# Inserts the given character in to the line where the cursor is
|
@@ -124,7 +125,7 @@ module Vedeu
|
|
124
125
|
|
125
126
|
down
|
126
127
|
|
127
|
-
bol
|
128
|
+
cursor.bol.refresh
|
128
129
|
|
129
130
|
refresh
|
130
131
|
end
|
@@ -178,6 +179,8 @@ module Vedeu
|
|
178
179
|
return self if x - 1 < 0
|
179
180
|
|
180
181
|
cursor.left.refresh
|
182
|
+
|
183
|
+
self
|
181
184
|
end
|
182
185
|
|
183
186
|
# Move the virtual cursor right.
|
@@ -187,6 +190,8 @@ module Vedeu
|
|
187
190
|
return self if x + 1 > line.size
|
188
191
|
|
189
192
|
cursor.right.refresh
|
193
|
+
|
194
|
+
self
|
190
195
|
end
|
191
196
|
|
192
197
|
# Move the virtual cursor up.
|
@@ -197,13 +202,9 @@ module Vedeu
|
|
197
202
|
|
198
203
|
cursor.up.refresh
|
199
204
|
|
200
|
-
|
201
|
-
eol
|
202
|
-
|
203
|
-
else
|
204
|
-
refresh
|
205
|
+
reposition_cursor_x!
|
205
206
|
|
206
|
-
|
207
|
+
self
|
207
208
|
end
|
208
209
|
|
209
210
|
# Move the virtual cursor down.
|
@@ -214,33 +215,27 @@ module Vedeu
|
|
214
215
|
|
215
216
|
cursor.down.refresh
|
216
217
|
|
217
|
-
|
218
|
-
eol
|
219
|
-
|
220
|
-
else
|
221
|
-
refresh
|
218
|
+
reposition_cursor_x!
|
222
219
|
|
223
|
-
|
220
|
+
self
|
224
221
|
end
|
225
222
|
|
226
|
-
|
227
|
-
#
|
228
|
-
# @return [Vedeu::Editor::Cursor]
|
229
|
-
def bol
|
230
|
-
cursor.bol.refresh
|
231
|
-
end
|
223
|
+
private
|
232
224
|
|
233
|
-
#
|
225
|
+
# Repositions the x coordinate of the virtual cursor to the end
|
226
|
+
# of the line if the x coordinate is beyond the end of the line.
|
227
|
+
#
|
228
|
+
# This is used when the cursor moves up or down, moving from a
|
229
|
+
# long line to a shorter line.
|
234
230
|
#
|
235
231
|
# @return [Vedeu::Editor::Cursor]
|
236
|
-
def
|
237
|
-
|
238
|
-
|
239
|
-
|
232
|
+
def reposition_cursor_x!
|
233
|
+
if x > line.size
|
234
|
+
cursor.x = line.size
|
235
|
+
cursor.refresh
|
236
|
+
end
|
240
237
|
end
|
241
238
|
|
242
|
-
private
|
243
|
-
|
244
239
|
# Returns the default options/attributes for this class.
|
245
240
|
#
|
246
241
|
# @return [Hash<Symbol => void|Symbol]
|
@@ -259,10 +254,10 @@ module Vedeu
|
|
259
254
|
#
|
260
255
|
# @return [Array<Vedeu::Views::Char>]
|
261
256
|
def output
|
262
|
-
Vedeu::Editor::Cropper.new(lines:
|
263
|
-
name:
|
264
|
-
ox:
|
265
|
-
oy:
|
257
|
+
Vedeu::Editor::Cropper.new(lines: lines,
|
258
|
+
name: name,
|
259
|
+
ox: ox,
|
260
|
+
oy: oy).viewport
|
266
261
|
end
|
267
262
|
|
268
263
|
# Return a virtual cursor to track the cursor position within
|
data/lib/vedeu/editor/line.rb
CHANGED
data/lib/vedeu/editor/lines.rb
CHANGED
data/lib/vedeu/events/event.rb
CHANGED
@@ -74,10 +74,9 @@ module Vedeu
|
|
74
74
|
|
75
75
|
private
|
76
76
|
|
77
|
-
# @
|
78
|
-
# must implement this method.
|
77
|
+
# @return [Vedeu::Geometry::Alignment]
|
79
78
|
def alignment
|
80
|
-
|
79
|
+
Vedeu::Geometry::Alignment.coerce(@alignment)
|
81
80
|
end
|
82
81
|
|
83
82
|
# Return the dimension.
|
@@ -243,9 +242,10 @@ module Vedeu
|
|
243
242
|
|
244
243
|
# Returns the default options/attributes for this class.
|
245
244
|
#
|
246
|
-
# @return [Hash<Symbol => NilClass,
|
245
|
+
# @return [Hash<Symbol => Boolean,Fixnum,NilClass,Symbol>]
|
247
246
|
def defaults
|
248
247
|
{
|
248
|
+
alignment: :none,
|
249
249
|
d: nil,
|
250
250
|
dn: nil,
|
251
251
|
d_dn: nil,
|
@@ -121,6 +121,19 @@ module Vedeu
|
|
121
121
|
}
|
122
122
|
end
|
123
123
|
|
124
|
+
# Returns a DSL instance responsible for defining the DSL
|
125
|
+
# methods of this model.
|
126
|
+
#
|
127
|
+
# @param client [Object|NilClass] The client binding represents
|
128
|
+
# the client application object that is currently invoking a
|
129
|
+
# DSL method. It is required so that we can send messages to
|
130
|
+
# the client application object should we need to.
|
131
|
+
# @return [Vedeu::Geometry::DSL] The DSL instance for this
|
132
|
+
# model.
|
133
|
+
def deputy(client = nil)
|
134
|
+
Vedeu::Geometry::DSL.new(self, client)
|
135
|
+
end
|
136
|
+
|
124
137
|
# An object is equal when its values are the same.
|
125
138
|
#
|
126
139
|
# @param other [Vedeu::Geometry::Geometry]
|
@@ -8,17 +8,9 @@ module Vedeu
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
# @
|
12
|
-
def alignment
|
13
|
-
Vedeu::Geometry::Alignment.coerce(@alignment)
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return [Hash<Symbol => NilClass,Boolean,Symbol>]
|
11
|
+
# @see Vedeu::Geometry::Dimension#defaults
|
17
12
|
def defaults
|
18
|
-
super.merge!(
|
19
|
-
default: Vedeu.width,
|
20
|
-
alignment: :none,
|
21
|
-
)
|
13
|
+
super.merge!(default: Vedeu.width)
|
22
14
|
end
|
23
15
|
|
24
16
|
end # XDimension
|
@@ -8,17 +8,9 @@ module Vedeu
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
# @
|
12
|
-
def alignment
|
13
|
-
Vedeu::Geometry::Alignment.coerce(@alignment)
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return [Hash<Symbol => NilClass,Boolean,Symbol>]
|
11
|
+
# @see Vedeu::Geometry::Dimension#defaults
|
17
12
|
def defaults
|
18
|
-
super.merge!(
|
19
|
-
default: Vedeu.height,
|
20
|
-
alignment: :none,
|
21
|
-
)
|
13
|
+
super.merge!(default: Vedeu.height)
|
22
14
|
end
|
23
15
|
|
24
16
|
end # YDimension
|
data/lib/vedeu/groups/group.rb
CHANGED
@@ -72,6 +72,18 @@ module Vedeu
|
|
72
72
|
interfaces.sort_by(&:zindex).map(&:name)
|
73
73
|
end
|
74
74
|
|
75
|
+
# Returns a DSL instance responsible for defining the DSL
|
76
|
+
# methods of this model.
|
77
|
+
#
|
78
|
+
# @param client [Object|NilClass] The client binding represents
|
79
|
+
# the client application object that is currently invoking a
|
80
|
+
# DSL method. It is required so that we can send messages to
|
81
|
+
# the client application object should we need to.
|
82
|
+
# @return [Vedeu::Groups::DSL] The DSL instance for this model.
|
83
|
+
def deputy(client = nil)
|
84
|
+
Vedeu::Groups::DSL.new(self, client)
|
85
|
+
end
|
86
|
+
|
75
87
|
# An object is equal when its values are the same.
|
76
88
|
#
|
77
89
|
# @param other [Vedeu::Groups::Group]
|
data/lib/vedeu/input/keymap.rb
CHANGED
@@ -42,6 +42,18 @@ module Vedeu
|
|
42
42
|
@keys = keys.add(key)
|
43
43
|
end
|
44
44
|
|
45
|
+
# Returns a DSL instance responsible for defining the DSL
|
46
|
+
# methods of this model.
|
47
|
+
#
|
48
|
+
# @param client [Object|NilClass] The client binding represents
|
49
|
+
# the client application object that is currently invoking a
|
50
|
+
# DSL method. It is required so that we can send messages to
|
51
|
+
# the client application object should we need to.
|
52
|
+
# @return [Vedeu::Input::DSL] The DSL instance for this model.
|
53
|
+
def deputy(client = nil)
|
54
|
+
Vedeu::Input::DSL.new(self, client)
|
55
|
+
end
|
56
|
+
|
45
57
|
# Returns the collection of keys defined for this keymap.
|
46
58
|
#
|
47
59
|
# @return [Vedeu::Input::Keys]
|
@@ -88,9 +88,14 @@ module Vedeu
|
|
88
88
|
@border ||= Vedeu.borders.by_name(name)
|
89
89
|
end
|
90
90
|
|
91
|
+
# @return [String] A string of blank characters.
|
92
|
+
def chars
|
93
|
+
@chars ||= (' ' * width).freeze
|
94
|
+
end
|
95
|
+
|
91
96
|
# @return [Vedeu::Colours::Colour]
|
92
97
|
def colour
|
93
|
-
interface.colour
|
98
|
+
@colour ||= interface.colour
|
94
99
|
end
|
95
100
|
|
96
101
|
# @return [Boolean]
|
@@ -120,9 +125,13 @@ module Vedeu
|
|
120
125
|
|
121
126
|
# @return [Fixnum]
|
122
127
|
def height
|
123
|
-
|
128
|
+
@height ||= if content_only?
|
129
|
+
border.height
|
130
|
+
|
131
|
+
else
|
132
|
+
geometry.height
|
124
133
|
|
125
|
-
|
134
|
+
end
|
126
135
|
end
|
127
136
|
|
128
137
|
# Returns the interface by name.
|
@@ -140,21 +149,9 @@ module Vedeu
|
|
140
149
|
# @return [String]
|
141
150
|
def optimised_output
|
142
151
|
Vedeu.timer("Optimised clearing #{clearing}: '#{name}'".freeze) do
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
@x = x
|
147
|
-
@colour = colour.to_s
|
148
|
-
@chars = (' ' * width).freeze
|
149
|
-
|
150
|
-
height.times do |iy|
|
151
|
-
output << Vedeu::Geometry::Position.new(@y + iy, @x).to_s
|
152
|
-
output << @colour
|
153
|
-
output << @chars
|
154
|
-
end
|
155
|
-
|
156
|
-
output << Vedeu::Geometry::Position.new(@y, @x).to_s
|
157
|
-
output
|
152
|
+
height.times.map do |iy|
|
153
|
+
Vedeu::Geometry::Position.new(y + iy, x).to_s + colour.to_s + chars
|
154
|
+
end.join + Vedeu::Geometry::Position.new(y, x).to_s
|
158
155
|
end
|
159
156
|
end
|
160
157
|
|
@@ -166,17 +163,11 @@ module Vedeu
|
|
166
163
|
# @return [Array<Array<Vedeu::Views::Char>>]
|
167
164
|
def output
|
168
165
|
Vedeu.timer("Clearing #{clearing}: '#{name}'".freeze) do
|
169
|
-
@
|
170
|
-
|
171
|
-
@width = width
|
172
|
-
@height = height
|
173
|
-
@colour = colour
|
174
|
-
|
175
|
-
@clear ||= Array.new(@height) do |iy|
|
176
|
-
Array.new(@width) do |ix|
|
166
|
+
@clear ||= Array.new(height) do |iy|
|
167
|
+
Array.new(width) do |ix|
|
177
168
|
Vedeu::Views::Char.new(value: ' '.freeze,
|
178
|
-
colour:
|
179
|
-
position: [
|
169
|
+
colour: colour,
|
170
|
+
position: [y + iy, x + ix])
|
180
171
|
end
|
181
172
|
end
|
182
173
|
end
|
@@ -184,30 +175,46 @@ module Vedeu
|
|
184
175
|
|
185
176
|
# @return [String]
|
186
177
|
def clearing
|
187
|
-
|
178
|
+
@clearing ||= if content_only?
|
179
|
+
'content'.freeze
|
180
|
+
|
181
|
+
else
|
182
|
+
'interface'.freeze
|
188
183
|
|
189
|
-
|
184
|
+
end
|
190
185
|
end
|
191
186
|
|
192
187
|
# @return [Fixnum]
|
193
188
|
def width
|
194
|
-
|
189
|
+
@width ||= if content_only?
|
190
|
+
border.width
|
191
|
+
|
192
|
+
else
|
193
|
+
geometry.width
|
195
194
|
|
196
|
-
|
195
|
+
end
|
197
196
|
end
|
198
197
|
|
199
198
|
# @return [Fixnum]
|
200
199
|
def y
|
201
|
-
|
200
|
+
@y ||= if content_only?
|
201
|
+
border.by
|
202
202
|
|
203
|
-
|
203
|
+
else
|
204
|
+
geometry.y
|
205
|
+
|
206
|
+
end
|
204
207
|
end
|
205
208
|
|
206
209
|
# @return [Fixnum]
|
207
210
|
def x
|
208
|
-
|
211
|
+
@x ||= if content_only?
|
212
|
+
border.bx
|
213
|
+
|
214
|
+
else
|
215
|
+
geometry.x
|
209
216
|
|
210
|
-
|
217
|
+
end
|
211
218
|
end
|
212
219
|
|
213
220
|
end # Clear
|
@@ -72,6 +72,19 @@ module Vedeu
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
# Returns a DSL instance responsible for defining the DSL
|
76
|
+
# methods of this model.
|
77
|
+
#
|
78
|
+
# @param client [Object|NilClass] The client binding represents
|
79
|
+
# the client application object that is currently invoking a
|
80
|
+
# DSL method. It is required so that we can send messages to
|
81
|
+
# the client application object should we need to.
|
82
|
+
# @return [Vedeu::Interfaces::DSL] The DSL instance for this
|
83
|
+
# model.
|
84
|
+
def deputy(client = nil)
|
85
|
+
Vedeu::Interfaces::DSL.new(self, client)
|
86
|
+
end
|
87
|
+
|
75
88
|
# Hide the named interface.
|
76
89
|
#
|
77
90
|
# Will hide the named interface. If the interface is currently
|
data/lib/vedeu/logging/ips.rb
CHANGED
@@ -41,10 +41,10 @@ module Vedeu
|
|
41
41
|
benchmark.run_comparison
|
42
42
|
benchmark.full_report
|
43
43
|
|
44
|
-
Vedeu.log(type: :debug, message: "IPS:\n#{$stdout.string}")
|
44
|
+
Vedeu.log(type: :debug, message: "IPS:\n#{$stdout.string}".freeze)
|
45
45
|
$stdout = @old_stdout
|
46
46
|
|
47
|
-
Vedeu.log(type: :debug, message: "Running: #{key}")
|
47
|
+
Vedeu.log(type: :debug, message: "Running: #{key}".freeze)
|
48
48
|
samples[key].call
|
49
49
|
end
|
50
50
|
|
data/lib/vedeu/menus/menu.rb
CHANGED
@@ -56,6 +56,18 @@ module Vedeu
|
|
56
56
|
@collection[@current]
|
57
57
|
end
|
58
58
|
|
59
|
+
# Returns a DSL instance responsible for defining the DSL
|
60
|
+
# methods of this model.
|
61
|
+
#
|
62
|
+
# @param client [Object|NilClass] The client binding represents
|
63
|
+
# the client application object that is currently invoking a
|
64
|
+
# DSL method. It is required so that we can send messages to
|
65
|
+
# the client application object should we need to.
|
66
|
+
# @return [Vedeu::Menus::DSL] The DSL instance for this model.
|
67
|
+
def deputy(client = nil)
|
68
|
+
Vedeu::Menus::DSL.new(self, client)
|
69
|
+
end
|
70
|
+
|
59
71
|
# Returns the item from the collection which shares the same
|
60
72
|
# index as the value of {Vedeu::Menus::Menu#selected}.
|
61
73
|
#
|
@@ -48,6 +48,19 @@ module Vedeu
|
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
51
|
+
# Returns a DSL instance responsible for defining the DSL
|
52
|
+
# methods of this model.
|
53
|
+
#
|
54
|
+
# @param client [Object|NilClass] The client binding represents
|
55
|
+
# the client application object that is currently invoking a
|
56
|
+
# DSL method. It is required so that we can send messages to
|
57
|
+
# the client application object should we need to.
|
58
|
+
# @return [Vedeu::DSL::Composition] The DSL instance for this
|
59
|
+
# model.
|
60
|
+
def deputy(client = nil)
|
61
|
+
Vedeu::DSL::Composition.new(self, client)
|
62
|
+
end
|
63
|
+
|
51
64
|
# @return [Vedeu::Views::ViewCollection]
|
52
65
|
def value
|
53
66
|
collection.coerce(@value, self)
|
@@ -64,7 +64,19 @@ module Vedeu
|
|
64
64
|
@chars ||= value.flat_map(&:chars)
|
65
65
|
end
|
66
66
|
|
67
|
-
#
|
67
|
+
# Returns a DSL instance responsible for defining the DSL
|
68
|
+
# methods of this model.
|
69
|
+
#
|
70
|
+
# @param client [Object|NilClass] The client binding represents
|
71
|
+
# the client application object that is currently invoking a
|
72
|
+
# DSL method. It is required so that we can send messages to
|
73
|
+
# the client application object should we need to.
|
74
|
+
# @return [Vedeu::DSL::Line] The DSL instance for this model.
|
75
|
+
def deputy(client = nil)
|
76
|
+
Vedeu::DSL::Line.new(self, client)
|
77
|
+
end
|
78
|
+
|
79
|
+
# An object is equal when its values are the same./
|
68
80
|
#
|
69
81
|
# @param other [Vedeu::Repositories::Collection]
|
70
82
|
# @return [Boolean]
|
@@ -77,6 +77,18 @@ module Vedeu
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
# Returns a DSL instance responsible for defining the DSL
|
81
|
+
# methods of this model.
|
82
|
+
#
|
83
|
+
# @param client [Object|NilClass] The client binding represents
|
84
|
+
# the client application object that is currently invoking a
|
85
|
+
# DSL method. It is required so that we can send messages to
|
86
|
+
# the client application object should we need to.
|
87
|
+
# @return [Vedeu::DSL::Stream] The DSL instance for this model.
|
88
|
+
def deputy(client = nil)
|
89
|
+
Vedeu::DSL::Stream.new(self, client)
|
90
|
+
end
|
91
|
+
|
80
92
|
# An object is equal when its values are the same.
|
81
93
|
#
|
82
94
|
# @param other [Vedeu::Views::Char]
|
@@ -76,6 +76,18 @@ module Vedeu
|
|
76
76
|
end
|
77
77
|
alias_method :<<, :add
|
78
78
|
|
79
|
+
# Returns a DSL instance responsible for defining the DSL
|
80
|
+
# methods of this model.
|
81
|
+
#
|
82
|
+
# @param client [Object|NilClass] The client binding represents
|
83
|
+
# the client application object that is currently invoking a
|
84
|
+
# DSL method. It is required so that we can send messages to
|
85
|
+
# the client application object should we need to.
|
86
|
+
# @return [Vedeu::DSL::View] The DSL instance for this model.
|
87
|
+
def deputy(client = nil)
|
88
|
+
Vedeu::DSL::View.new(self, client)
|
89
|
+
end
|
90
|
+
|
79
91
|
# @return [Vedeu::Views::Lines]
|
80
92
|
def value
|
81
93
|
collection.coerce(@value, self)
|
@@ -19,7 +19,7 @@ module Vedeu
|
|
19
19
|
def clear
|
20
20
|
threads = storage.map do |renderer|
|
21
21
|
Vedeu.log(type: :output,
|
22
|
-
message: "Clearing via #{renderer.class.name}")
|
22
|
+
message: "Clearing via #{renderer.class.name}".freeze)
|
23
23
|
|
24
24
|
Thread.new(renderer) do
|
25
25
|
mutex.synchronize do
|
@@ -53,7 +53,7 @@ module Vedeu
|
|
53
53
|
def render(output)
|
54
54
|
threads = storage.map do |renderer|
|
55
55
|
Vedeu.log(type: :output,
|
56
|
-
message: "Rendering via #{renderer.class.name}")
|
56
|
+
message: "Rendering via #{renderer.class.name}".freeze)
|
57
57
|
|
58
58
|
Thread.new(renderer) do
|
59
59
|
mutex.synchronize do
|
@@ -87,18 +87,6 @@ module Vedeu
|
|
87
87
|
klass.send(:extend, ClassMethods)
|
88
88
|
end
|
89
89
|
|
90
|
-
# Returns a DSL instance responsible for defining the DSL
|
91
|
-
# methods of this model.
|
92
|
-
#
|
93
|
-
# @param client [Object|NilClass] The client binding represents
|
94
|
-
# the client application object that is currently invoking a
|
95
|
-
# DSL method. It is required so that we can send messages to
|
96
|
-
# the client application object should we need to.
|
97
|
-
# @return [void] The DSL instance for this model.
|
98
|
-
def deputy(client = nil)
|
99
|
-
Object.const_get(dsl_class).new(self, client)
|
100
|
-
end
|
101
|
-
|
102
90
|
# @note If a block is given, store the model, return the model
|
103
91
|
# after yielding.
|
104
92
|
# @todo Perhaps some validation could be added here?
|
@@ -111,26 +99,6 @@ module Vedeu
|
|
111
99
|
new_model
|
112
100
|
end
|
113
101
|
|
114
|
-
private
|
115
|
-
|
116
|
-
# Returns the DSL class name responsible for this model.
|
117
|
-
#
|
118
|
-
# @return [String]
|
119
|
-
def dsl_class
|
120
|
-
case demodulize(self.class.name)
|
121
|
-
when 'Border'.freeze then 'Vedeu::Borders::DSL'.freeze
|
122
|
-
when 'Buffer'.freeze then 'Vedeu::Buffers::DSL'.freeze
|
123
|
-
when 'Geometry'.freeze then 'Vedeu::Geometry::DSL'.freeze
|
124
|
-
when 'Group'.freeze then 'Vedeu::Groups::DSL'.freeze
|
125
|
-
when 'Interface'.freeze then 'Vedeu::Interfaces::DSL'.freeze
|
126
|
-
when 'Keymap'.freeze then 'Vedeu::Input::DSL'.freeze
|
127
|
-
when 'Menu'.freeze then 'Vedeu::Menus::DSL'.freeze
|
128
|
-
# when 'ModelTestClass' then 'Vedeu::Repositories::ModelTestClass::DSL'
|
129
|
-
else
|
130
|
-
'Vedeu::DSL::'.freeze + demodulize(self.class.name)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
102
|
end # Model
|
135
103
|
|
136
104
|
end # Repositories
|
@@ -69,7 +69,7 @@ module Vedeu
|
|
69
69
|
rescue StandardError => uncaught_exception
|
70
70
|
output = if configuration.debug?
|
71
71
|
uncaught_exception.message + "\n" +
|
72
|
-
uncaught_exception.backtrace.join("\n")
|
72
|
+
uncaught_exception.backtrace.join("\n".freeze)
|
73
73
|
else
|
74
74
|
uncaught_exception.message
|
75
75
|
end
|
data/lib/vedeu/version.rb
CHANGED
@@ -208,6 +208,14 @@ module Vedeu
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
+
describe '#deputy' do
|
212
|
+
subject { instance.deputy }
|
213
|
+
|
214
|
+
it 'returns the DSL instance' do
|
215
|
+
subject.must_be_instance_of(Vedeu::Borders::DSL)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
211
219
|
describe '#width' do
|
212
220
|
let(:geometry) {
|
213
221
|
Vedeu::Geometry::Geometry.new(name: _name, width: 8)
|
@@ -40,7 +40,7 @@ module Vedeu
|
|
40
40
|
context 'when the index < 0' do
|
41
41
|
let(:index) { -3 }
|
42
42
|
|
43
|
-
it { subject.must_equal('
|
43
|
+
it { subject.must_equal('Some text') }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -67,7 +67,7 @@ module Vedeu
|
|
67
67
|
context 'when the index < 0' do
|
68
68
|
let(:index) { -3 }
|
69
69
|
|
70
|
-
it { subject.must_equal([:helium, :lithium, :beryllium]) }
|
70
|
+
it { subject.must_equal([:hydrogen, :helium, :lithium, :beryllium]) }
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -75,6 +75,14 @@ module Vedeu
|
|
75
75
|
}
|
76
76
|
end
|
77
77
|
|
78
|
+
describe '#execute' do
|
79
|
+
subject { instance.execute }
|
80
|
+
|
81
|
+
it { subject.must_be_instance_of(String) }
|
82
|
+
|
83
|
+
it { subject.must_equal("Hydrogen\nHelium\nLithium") }
|
84
|
+
end
|
85
|
+
|
78
86
|
describe '#delete_character' do
|
79
87
|
subject { instance.delete_character }
|
80
88
|
|
@@ -99,20 +107,6 @@ module Vedeu
|
|
99
107
|
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
100
108
|
end
|
101
109
|
|
102
|
-
describe '#down' do
|
103
|
-
subject { instance.down }
|
104
|
-
|
105
|
-
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
106
|
-
end
|
107
|
-
|
108
|
-
describe '#execute' do
|
109
|
-
subject { instance.execute }
|
110
|
-
|
111
|
-
it { subject.must_be_instance_of(String) }
|
112
|
-
|
113
|
-
it { subject.must_equal("Hydrogen\nHelium\nLithium") }
|
114
|
-
end
|
115
|
-
|
116
110
|
describe '#insert_character' do
|
117
111
|
it { instance.must_respond_to(:insert_character) }
|
118
112
|
|
@@ -131,18 +125,6 @@ module Vedeu
|
|
131
125
|
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
132
126
|
end
|
133
127
|
|
134
|
-
describe '#left' do
|
135
|
-
subject { instance.left }
|
136
|
-
|
137
|
-
context 'when moving goes out of bounds' do
|
138
|
-
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
139
|
-
end
|
140
|
-
|
141
|
-
# context 'when moving does not go out of bounds' do
|
142
|
-
# it { subject.must_be_instance_of(Vedeu::Editor::Cursor) }
|
143
|
-
# end
|
144
|
-
end
|
145
|
-
|
146
128
|
describe '#line' do
|
147
129
|
subject { instance.line }
|
148
130
|
|
@@ -179,28 +161,28 @@ module Vedeu
|
|
179
161
|
it { instance.must_respond_to(:refresh) }
|
180
162
|
end
|
181
163
|
|
182
|
-
describe '#
|
183
|
-
subject { instance.
|
164
|
+
describe '#down' do
|
165
|
+
subject { instance.down }
|
184
166
|
|
185
|
-
it { subject.must_be_instance_of(Vedeu::Editor::
|
167
|
+
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
186
168
|
end
|
187
169
|
|
188
|
-
describe '#
|
189
|
-
subject { instance.
|
170
|
+
describe '#left' do
|
171
|
+
subject { instance.left }
|
190
172
|
|
191
173
|
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
192
174
|
end
|
193
175
|
|
194
|
-
describe '#
|
195
|
-
subject { instance.
|
176
|
+
describe '#right' do
|
177
|
+
subject { instance.right }
|
196
178
|
|
197
|
-
it { subject.must_be_instance_of(Vedeu::Editor::
|
179
|
+
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
198
180
|
end
|
199
181
|
|
200
|
-
describe '#
|
201
|
-
subject { instance.
|
182
|
+
describe '#up' do
|
183
|
+
subject { instance.up }
|
202
184
|
|
203
|
-
it { subject.must_be_instance_of(Vedeu::Editor::
|
185
|
+
it { subject.must_be_instance_of(Vedeu::Editor::Document) }
|
204
186
|
end
|
205
187
|
|
206
188
|
end # Editor
|
@@ -92,6 +92,14 @@ module Vedeu
|
|
92
92
|
# it { skip }
|
93
93
|
end
|
94
94
|
|
95
|
+
describe '#deputy' do
|
96
|
+
subject { instance.deputy }
|
97
|
+
|
98
|
+
it 'returns the DSL instance' do
|
99
|
+
subject.must_be_instance_of(Vedeu::Geometry::DSL)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
95
103
|
describe '#eql?' do
|
96
104
|
let(:other) { instance }
|
97
105
|
|
@@ -92,6 +92,14 @@ module Vedeu
|
|
92
92
|
it { subject.must_equal(['a', 'b', 'c']) }
|
93
93
|
end
|
94
94
|
|
95
|
+
describe '#deputy' do
|
96
|
+
subject { instance.deputy }
|
97
|
+
|
98
|
+
it 'returns the DSL instance' do
|
99
|
+
subject.must_be_instance_of(Vedeu::Groups::DSL)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
95
103
|
describe '#hide' do
|
96
104
|
subject { instance.hide }
|
97
105
|
|
@@ -51,6 +51,14 @@ module Vedeu
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe '#deputy' do
|
55
|
+
subject { instance.deputy }
|
56
|
+
|
57
|
+
it 'returns the DSL instance' do
|
58
|
+
subject.must_be_instance_of(Vedeu::Input::DSL)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
54
62
|
describe '#key_defined?' do
|
55
63
|
let(:input) { 'a' }
|
56
64
|
|
@@ -80,6 +80,14 @@ module Vedeu
|
|
80
80
|
}
|
81
81
|
end
|
82
82
|
|
83
|
+
describe '#deputy' do
|
84
|
+
subject { instance.deputy }
|
85
|
+
|
86
|
+
it 'returns the DSL instance' do
|
87
|
+
subject.must_be_instance_of(Vedeu::Interfaces::DSL)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
83
91
|
describe '#hide' do
|
84
92
|
before { Vedeu.stubs(:trigger) }
|
85
93
|
|
@@ -52,6 +52,14 @@ module Vedeu
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
describe '#deputy' do
|
56
|
+
subject { instance.deputy }
|
57
|
+
|
58
|
+
it 'returns the DSL instance' do
|
59
|
+
subject.must_be_instance_of(Vedeu::Menus::DSL)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
describe '#selected' do
|
56
64
|
subject { instance.selected }
|
57
65
|
|
@@ -61,6 +61,13 @@ module Vedeu
|
|
61
61
|
it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
|
62
62
|
end
|
63
63
|
|
64
|
+
describe '#deputy' do
|
65
|
+
subject { instance.deputy }
|
66
|
+
|
67
|
+
it 'returns the DSL instance' do
|
68
|
+
subject.must_be_instance_of(Vedeu::DSL::Composition)
|
69
|
+
end
|
70
|
+
end
|
64
71
|
|
65
72
|
end # Composition
|
66
73
|
|
@@ -100,6 +100,14 @@ module Vedeu
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
describe '#deputy' do
|
104
|
+
subject { instance.deputy }
|
105
|
+
|
106
|
+
it 'returns the DSL instance' do
|
107
|
+
subject.must_be_instance_of(Vedeu::DSL::Line)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
103
111
|
describe '#eql?' do
|
104
112
|
let(:other) { instance }
|
105
113
|
|
@@ -91,6 +91,14 @@ module Vedeu
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
describe '#deputy' do
|
95
|
+
subject { instance.deputy }
|
96
|
+
|
97
|
+
it 'returns the DSL instance' do
|
98
|
+
subject.must_be_instance_of(Vedeu::DSL::Stream)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
94
102
|
describe '#eql?' do
|
95
103
|
let(:other) { described.new(attributes) }
|
96
104
|
|
@@ -54,6 +54,14 @@ module Vedeu
|
|
54
54
|
# it { skip }
|
55
55
|
end
|
56
56
|
|
57
|
+
describe '#deputy' do
|
58
|
+
subject { instance.deputy }
|
59
|
+
|
60
|
+
it 'returns the DSL instance' do
|
61
|
+
subject.must_be_instance_of(Vedeu::DSL::View)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
57
65
|
describe '#value' do
|
58
66
|
subject { instance.value }
|
59
67
|
|
@@ -49,14 +49,6 @@ module Vedeu
|
|
49
49
|
# it { skip }
|
50
50
|
end
|
51
51
|
|
52
|
-
describe '#deputy' do
|
53
|
-
subject { instance.deputy }
|
54
|
-
|
55
|
-
# it 'returns the DSL instance' do
|
56
|
-
# subject.must_be_instance_of(Vedeu::Repositories::ModelTestClass::DSL)
|
57
|
-
# end
|
58
|
-
end
|
59
|
-
|
60
52
|
describe '#store' do
|
61
53
|
subject { instance.store }
|
62
54
|
|
data/test/test_helper.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.48
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|