vedeu 0.8.20 → 0.8.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl/by_method/geometry/align_centre.md +3 -0
  3. data/docs/dsl/by_method/geometry/columns.md +12 -1
  4. data/docs/dsl/by_method/geometry/height.md +9 -0
  5. data/docs/dsl/by_method/geometry/horizontal_alignment.md +3 -1
  6. data/docs/dsl/by_method/geometry/rows.md +12 -1
  7. data/docs/dsl/by_method/geometry/vertical_alignment.md +3 -1
  8. data/docs/dsl/by_method/geometry/width.md +9 -0
  9. data/docs/dsl/by_method/geometry/x.md +11 -1
  10. data/docs/dsl/by_method/geometry/xn.md +14 -1
  11. data/docs/dsl/by_method/geometry/y.md +11 -1
  12. data/docs/dsl/by_method/geometry/yn.md +12 -1
  13. data/docs/dsl/by_method/geometry/zindex.md +18 -0
  14. data/docs/dsl/by_method/template_for.md +10 -0
  15. data/docs/dsl/by_method/use.md +21 -0
  16. data/integrations/342_streams.rb +3 -1
  17. data/integrations/dsl_app_001.rb +3 -1
  18. data/integrations/dsl_app_002.rb +3 -1
  19. data/integrations/dsl_app_003.rb +3 -1
  20. data/integrations/dsl_app_004.rb +3 -1
  21. data/integrations/dsl_app_005.rb +3 -1
  22. data/integrations/dsl_app_006.rb +3 -1
  23. data/integrations/dsl_app_007.rb +3 -1
  24. data/integrations/dsl_app_008.rb +3 -1
  25. data/integrations/dsl_app_009.rb +3 -1
  26. data/integrations/dsl_app_010.rb +3 -1
  27. data/integrations/dsl_app_011.rb +3 -1
  28. data/integrations/dsl_app_012.rb +3 -1
  29. data/integrations/dsl_app_013.rb +3 -1
  30. data/integrations/dsl_app_014.rb +3 -1
  31. data/integrations/dsl_app_015.rb +3 -1
  32. data/integrations/dsl_app_016.rb +3 -1
  33. data/integrations/dsl_app_017.rb +3 -1
  34. data/integrations/dsl_app_018.rb +3 -1
  35. data/integrations/dsl_app_019.rb +3 -1
  36. data/integrations/dsl_app_020.rb +3 -1
  37. data/integrations/dsl_app_021.rb +3 -1
  38. data/integrations/dsl_app_022.rb +3 -1
  39. data/integrations/dsl_app_border_001.rb +3 -1
  40. data/integrations/dsl_app_border_002.rb +3 -1
  41. data/integrations/dsl_app_border_003.rb +3 -1
  42. data/integrations/dsl_app_border_004.rb +3 -1
  43. data/integrations/dsl_app_border_005.rb +3 -1
  44. data/integrations/dsl_app_border_006.rb +3 -1
  45. data/integrations/dsl_app_border_007.rb +3 -1
  46. data/integrations/dsl_app_border_008.rb +3 -1
  47. data/integrations/dsl_app_border_009.rb +3 -1
  48. data/integrations/dsl_app_border_010.rb +3 -1
  49. data/integrations/dsl_app_border_011.rb +3 -1
  50. data/integrations/test_runner.rb +20 -10
  51. data/lib/vedeu/borders/border.rb +3 -0
  52. data/lib/vedeu/borders/dsl.rb +1 -1
  53. data/lib/vedeu/borders/refresh.rb +1 -1
  54. data/lib/vedeu/borders/repository.rb +0 -2
  55. data/lib/vedeu/buffers/buffer.rb +1 -0
  56. data/lib/vedeu/buffers/repository.rb +0 -2
  57. data/lib/vedeu/buffers/view.rb +3 -3
  58. data/lib/vedeu/cells/empty.rb +3 -0
  59. data/lib/vedeu/colours/background.rb +3 -8
  60. data/lib/vedeu/colours/foreground.rb +3 -8
  61. data/lib/vedeu/configuration/api.rb +1 -1
  62. data/lib/vedeu/configuration/configuration.rb +3 -2
  63. data/lib/vedeu/cursors/cursor.rb +1 -1
  64. data/lib/vedeu/cursors/repository.rb +0 -2
  65. data/lib/vedeu/dsl/border.rb +1 -1
  66. data/lib/vedeu/dsl/dsl.rb +1 -1
  67. data/lib/vedeu/dsl/elements.rb +4 -4
  68. data/lib/vedeu/dsl/geometry.rb +2 -2
  69. data/lib/vedeu/dsl/helpers/attributes.rb +1 -1
  70. data/lib/vedeu/dsl/use.rb +1 -21
  71. data/lib/vedeu/dsl/view.rb +3 -13
  72. data/lib/vedeu/dsl/views.rb +15 -18
  73. data/lib/vedeu/editor/lines.rb +1 -1
  74. data/lib/vedeu/editor/repository.rb +0 -2
  75. data/lib/vedeu/esc/background.rb +17 -17
  76. data/lib/vedeu/esc/colours.rb +2 -2
  77. data/lib/vedeu/esc/esc.rb +1 -1
  78. data/lib/vedeu/esc/foreground.rb +17 -17
  79. data/lib/vedeu/events/event.rb +1 -3
  80. data/lib/vedeu/events/repository.rb +0 -2
  81. data/lib/vedeu/geometries/dsl/dsl.rb +18 -183
  82. data/lib/vedeu/geometries/move.rb +34 -49
  83. data/lib/vedeu/geometries/position.rb +1 -1
  84. data/lib/vedeu/geometries/repository.rb +0 -2
  85. data/lib/vedeu/groups/dsl.rb +1 -1
  86. data/lib/vedeu/groups/repository.rb +0 -2
  87. data/lib/vedeu/input/dsl.rb +2 -3
  88. data/lib/vedeu/input/key.rb +1 -1
  89. data/lib/vedeu/input/repository.rb +0 -2
  90. data/lib/vedeu/interfaces/dsl.rb +2 -3
  91. data/lib/vedeu/interfaces/interface.rb +3 -0
  92. data/lib/vedeu/interfaces/null.rb +3 -0
  93. data/lib/vedeu/interfaces/repository.rb +0 -2
  94. data/lib/vedeu/logging/debug.rb +1 -1
  95. data/lib/vedeu/logging/log.rb +19 -5
  96. data/lib/vedeu/logging/timer.rb +2 -2
  97. data/lib/vedeu/menus/dsl.rb +2 -3
  98. data/lib/vedeu/menus/repository.rb +0 -2
  99. data/lib/vedeu/models/page.rb +1 -1
  100. data/lib/vedeu/models/row.rb +1 -1
  101. data/lib/vedeu/output/compressor_cache.rb +10 -4
  102. data/lib/vedeu/output/compressors/simple.rb +7 -3
  103. data/lib/vedeu/output/write.rb +3 -0
  104. data/lib/vedeu/presentation/colour.rb +1 -1
  105. data/lib/vedeu/presentation/position.rb +1 -1
  106. data/lib/vedeu/presentation/presentation.rb +0 -4
  107. data/lib/vedeu/presentation/styles.rb +1 -1
  108. data/lib/vedeu/renderers/all.rb +4 -4
  109. data/lib/vedeu/repositories/assemblage.rb +2 -2
  110. data/lib/vedeu/repositories/model.rb +2 -6
  111. data/lib/vedeu/repositories/registerable.rb +10 -0
  112. data/lib/vedeu/repositories/store.rb +1 -1
  113. data/lib/vedeu/runtime/application.rb +3 -3
  114. data/lib/vedeu/runtime/launcher.rb +1 -1
  115. data/lib/vedeu/templating/helpers.rb +4 -4
  116. data/lib/vedeu/terminal/terminal.rb +2 -2
  117. data/lib/vedeu/version.rb +1 -1
  118. data/lib/vedeu/views/composition.rb +3 -0
  119. data/lib/vedeu/views/line.rb +3 -0
  120. data/lib/vedeu/views/stream.rb +3 -0
  121. data/lib/vedeu/views/view.rb +3 -0
  122. data/lib/vedeu.rb +3 -0
  123. data/test/lib/vedeu/borders/repository_test.rb +0 -2
  124. data/test/lib/vedeu/buffers/repository_test.rb +0 -2
  125. data/test/lib/vedeu/cursors/repository_test.rb +0 -2
  126. data/test/lib/vedeu/dsl/border_test.rb +26 -16
  127. data/test/lib/vedeu/editor/repository_test.rb +0 -2
  128. data/test/lib/vedeu/events/repository_test.rb +0 -2
  129. data/test/lib/vedeu/geometries/repository_test.rb +0 -4
  130. data/test/lib/vedeu/groups/repository_test.rb +0 -2
  131. data/test/lib/vedeu/input/repository_test.rb +0 -2
  132. data/test/lib/vedeu/interfaces/repository_test.rb +0 -2
  133. data/test/lib/vedeu/menus/repository_test.rb +0 -2
  134. data/test/lib/vedeu/presentation/colour_test.rb +6 -0
  135. data/test/lib/vedeu/presentation/position_test.rb +2 -0
  136. data/test/lib/vedeu/presentation/presentation_test.rb +10 -1
  137. data/test/lib/vedeu/presentation/styles_test.rb +6 -0
  138. data/test/lib/vedeu/repositories/registerable_test.rb +11 -1
  139. data/test/support/examples/material_colours_app.rb +0 -93
  140. metadata +5 -2
@@ -12,7 +12,7 @@ module Vedeu
12
12
 
13
13
  extend self
14
14
 
15
- # @param block [Proc]
15
+ # @macro param_block
16
16
  # @return [String]
17
17
  def black(&block)
18
18
  if block_given?
@@ -24,7 +24,7 @@ module Vedeu
24
24
  end
25
25
  end
26
26
 
27
- # @param block [Proc]
27
+ # @macro param_block
28
28
  # @return [String]
29
29
  def red(&block)
30
30
  if block_given?
@@ -36,7 +36,7 @@ module Vedeu
36
36
  end
37
37
  end
38
38
 
39
- # @param block [Proc]
39
+ # @macro param_block
40
40
  # @return [String]
41
41
  def green(&block)
42
42
  if block_given?
@@ -48,7 +48,7 @@ module Vedeu
48
48
  end
49
49
  end
50
50
 
51
- # @param block [Proc]
51
+ # @macro param_block
52
52
  # @return [String]
53
53
  def yellow(&block)
54
54
  if block_given?
@@ -60,7 +60,7 @@ module Vedeu
60
60
  end
61
61
  end
62
62
 
63
- # @param block [Proc]
63
+ # @macro param_block
64
64
  # @return [String]
65
65
  def blue(&block)
66
66
  if block_given?
@@ -72,7 +72,7 @@ module Vedeu
72
72
  end
73
73
  end
74
74
 
75
- # @param block [Proc]
75
+ # @macro param_block
76
76
  # @return [String]
77
77
  def magenta(&block)
78
78
  if block_given?
@@ -84,7 +84,7 @@ module Vedeu
84
84
  end
85
85
  end
86
86
 
87
- # @param block [Proc]
87
+ # @macro param_block
88
88
  # @return [String]
89
89
  def cyan(&block)
90
90
  if block_given?
@@ -96,7 +96,7 @@ module Vedeu
96
96
  end
97
97
  end
98
98
 
99
- # @param block [Proc]
99
+ # @macro param_block
100
100
  # @return [String]
101
101
  def light_grey(&block)
102
102
  if block_given?
@@ -108,7 +108,7 @@ module Vedeu
108
108
  end
109
109
  end
110
110
 
111
- # @param block [Proc]
111
+ # @macro param_block
112
112
  # @return [String]
113
113
  def default(&block)
114
114
  if block_given?
@@ -120,7 +120,7 @@ module Vedeu
120
120
  end
121
121
  end
122
122
 
123
- # @param block [Proc]
123
+ # @macro param_block
124
124
  # @return [String]
125
125
  def dark_grey(&block)
126
126
  if block_given?
@@ -132,7 +132,7 @@ module Vedeu
132
132
  end
133
133
  end
134
134
 
135
- # @param block [Proc]
135
+ # @macro param_block
136
136
  # @return [String]
137
137
  def light_red(&block)
138
138
  if block_given?
@@ -144,7 +144,7 @@ module Vedeu
144
144
  end
145
145
  end
146
146
 
147
- # @param block [Proc]
147
+ # @macro param_block
148
148
  # @return [String]
149
149
  def light_green(&block)
150
150
  if block_given?
@@ -156,7 +156,7 @@ module Vedeu
156
156
  end
157
157
  end
158
158
 
159
- # @param block [Proc]
159
+ # @macro param_block
160
160
  # @return [String]
161
161
  def light_yellow(&block)
162
162
  if block_given?
@@ -168,7 +168,7 @@ module Vedeu
168
168
  end
169
169
  end
170
170
 
171
- # @param block [Proc]
171
+ # @macro param_block
172
172
  # @return [String]
173
173
  def light_blue(&block)
174
174
  if block_given?
@@ -180,7 +180,7 @@ module Vedeu
180
180
  end
181
181
  end
182
182
 
183
- # @param block [Proc]
183
+ # @macro param_block
184
184
  # @return [String]
185
185
  def light_magenta(&block)
186
186
  if block_given?
@@ -192,7 +192,7 @@ module Vedeu
192
192
  end
193
193
  end
194
194
 
195
- # @param block [Proc]
195
+ # @macro param_block
196
196
  # @return [String]
197
197
  def light_cyan(&block)
198
198
  if block_given?
@@ -204,7 +204,7 @@ module Vedeu
204
204
  end
205
205
  end
206
206
 
207
- # @param block [Proc]
207
+ # @macro param_block
208
208
  # @return [String]
209
209
  def white(&block)
210
210
  if block_given?
@@ -52,9 +52,7 @@ module Vedeu
52
52
  # execution of the triggered event to only execute once the
53
53
  # debounce has expired. Subsequent triggers before debounce
54
54
  # expiry are ignored.
55
- # @param block [Proc] The event to be executed when triggered.
56
- # This block could be a method call, or the triggering of
57
- # another event, or sequence of either/both.
55
+ # @macro param_block
58
56
  #
59
57
  # @example
60
58
  # Vedeu.bind :my_event do |some, args|
@@ -10,8 +10,6 @@ module Vedeu
10
10
  #
11
11
  class Repository < Vedeu::Repositories::Repository
12
12
 
13
- singleton_class.send(:alias_method, :events, :repository)
14
-
15
13
  class << self
16
14
 
17
15
  # Remove all stored models from the repository.
@@ -123,45 +123,14 @@ module Vedeu
123
123
  model
124
124
  end
125
125
 
126
- # Vertically align the interface/view to the bottom of the
127
- # terminal.
128
- #
129
- # Vedeu.geometry :some_interface do
130
- # # `height` is a positive integer, e.g. 30
131
- # align_bottom 30
132
- #
133
- # # this is the same as:
134
- # # vertical_alignment(:bottom, 30)
135
- #
136
- # # or you can use: (see notes)
137
- # # align(vertical: :bottom, height: 30)
138
- #
139
- # # ... some code
140
- # end
141
- #
126
+ # {include:file:docs/dsl/by_method/geometry/align_bottom.md}
142
127
  # @param height [Fixnum] The number of lines/rows.
143
128
  # @return [Vedeu::Geometries::Geometry]
144
129
  def align_bottom(height = nil)
145
130
  vertical_alignment(:bottom, height)
146
131
  end
147
132
 
148
- # Horizontally align the interface/view centrally.
149
- #
150
- # Vedeu.geometry :some_interface do
151
- # # `width` is a positive integer, e.g. 30
152
- # align_centre 30
153
- #
154
- # # this is the same as:
155
- # # horizontal_alignment(:centre, 30)
156
- #
157
- # # or you can use: (see notes)
158
- # # align(horizontal: :centre, width: 30)
159
- #
160
- # # ... some code
161
- # end
162
- #
163
- # # Also allows `align_center` if preferred.
164
- #
133
+ # {include:file:docs/dsl/by_method/geometry/align_centre.md}
165
134
  # @param width [Fixnum] The number of characters/columns.
166
135
  # @return [Vedeu::Geometries::Geometry]
167
136
  def align_centre(width = nil)
@@ -169,103 +138,35 @@ module Vedeu
169
138
  end
170
139
  alias align_center align_centre
171
140
 
172
- # Horizontally align the interface/view to the left.
173
- #
174
- # Vedeu.geometry :some_interface do
175
- # # `width` is a positive integer, e.g. 30
176
- # align_left 30
177
- #
178
- # # this is the same as:
179
- # # horizontal_alignment(:left, 30)
180
- #
181
- # # or you can use: (see notes)
182
- # # align(horizontal: :left, width: 30)
183
- #
184
- # # ... some code
185
- # end
186
- #
141
+ # {include:file:docs/dsl/by_method/geometry/align_left.md}
187
142
  # @param width [Fixnum] The number of characters/columns.
188
143
  # @return [Vedeu::Geometries::Geometry]
189
144
  def align_left(width = nil)
190
145
  horizontal_alignment(:left, width)
191
146
  end
192
147
 
193
- # Vertically align the interface/view to the middle of the
194
- # terminal.
195
- #
196
- # Vedeu.geometry :some_interface do
197
- # # `height` is a positive integer, e.g. 30
198
- # align_middle 30
199
- #
200
- # # this is the same as:
201
- # # vertical_alignment(:middle, 30)
202
- #
203
- # # or you can use: (see notes)
204
- # # align(vertical: :middle, height: 30)
205
- #
206
- # # ... some code
207
- # end
208
- #
148
+ # {include:file:docs/dsl/by_method/geometry/align_middle.md}
209
149
  # @param height [Fixnum] The number of lines/rows.
210
150
  # @return [Vedeu::Geometries::Geometry]
211
151
  def align_middle(height = nil)
212
152
  vertical_alignment(:middle, height)
213
153
  end
214
154
 
215
- # Align the interface/view to the right.
216
- #
217
- # Vedeu.geometry :some_interface do
218
- # # `width` is a positive integer, e.g. 30
219
- # align_right 30
220
- #
221
- # # this is the same as:
222
- # # horizontal_alignment(:right, 30)
223
- #
224
- # # or you can use: (see notes)
225
- # # align(horizontal: :right, width: 30)
226
- #
227
- # # ... some code
228
- # end
229
- #
155
+ # {include:file:docs/dsl/by_method/geometry/align_right.md}
230
156
  # @param width [Fixnum] The number of characters/columns.
231
157
  # @return [Vedeu::Geometries::Geometry]
232
158
  def align_right(width = nil)
233
159
  horizontal_alignment(:right, width)
234
160
  end
235
161
 
236
- # Vertically align the interface/view to the top of the
237
- # terminal.
238
- #
239
- # Vedeu.geometry :some_interface do
240
- # # `height` is a positive integer, e.g. 30
241
- # align_top 30
242
- #
243
- # # this is the same as:
244
- # # vertical_alignment(:top, 30)
245
- #
246
- # # or you can use: (see notes)
247
- # # align(vertical: :top, height: 30)
248
- #
249
- # # ... some code
250
- # end
251
- #
162
+ # {include:file:docs/dsl/by_method/geometry/align_top.md}
252
163
  # @param height [Fixnum] The number of lines/rows.
253
164
  # @return [Vedeu::Geometries::Geometry]
254
165
  def align_top(height = nil)
255
166
  vertical_alignment(:top, height)
256
167
  end
257
168
 
258
- # Returns the width in characters for the number of columns
259
- # specified.
260
- #
261
- # Vedeu.geometry :main_interface do
262
- # # ... some code
263
- # width columns(9) # Vedeu.width # => 92 (for example)
264
- # # 92 / 12 = 7
265
- # # 7 * 9 = 63
266
- # # Therefore, width is 63 characters.
267
- # end
268
- #
169
+ # {include:file:docs/dsl/by_method/geometry/columns.md}
269
170
  # @param value [Fixnum]
270
171
  # @macro raise_out_of_range
271
172
  # @return [Fixnum|Vedeu::Error::OutOfRange]
@@ -273,14 +174,7 @@ module Vedeu
273
174
  Vedeu::Geometries::Grid.columns(value)
274
175
  end
275
176
 
276
- # Specify the number of characters/rows/lines tall the interface
277
- # will be. This value will be ignored when `y` and `yn` are set.
278
- #
279
- # Vedeu.geometry :some_interface do
280
- # height 8
281
- # # ... some code
282
- # end
283
- #
177
+ # {include:file:docs/dsl/by_method/geometry/height.md}
284
178
  # @param value [Fixnum]
285
179
  # @return [Fixnum]
286
180
  def height(value)
@@ -288,17 +182,7 @@ module Vedeu
288
182
  end
289
183
  alias height= height
290
184
 
291
- # Returns the height in characters for the number of rows
292
- # specified.
293
- #
294
- # Vedeu.geometry :main_interface do
295
- # # ... some code
296
- # height rows(3) # Vedeu.height # => 38 (for example)
297
- # # 38 / 12 = 3
298
- # # 3 * 3 = 9
299
- # # Therefore, height is 9 characters.
300
- # end
301
- #
185
+ # {include:file:docs/dsl/by_method/geometry/rows.md}
302
186
  # @param value [Fixnum]
303
187
  # @macro raise_out_of_range
304
188
  # @return [Fixnum]
@@ -306,14 +190,7 @@ module Vedeu
306
190
  Vedeu::Geometries::Grid.rows(value)
307
191
  end
308
192
 
309
- # Specify the number of characters/columns wide the interface
310
- # will be. This value will be ignored when `x` and `xn` are set.
311
- #
312
- # Vedeu.geometry :some_interface do
313
- # width 25
314
- # # ... some code
315
- # end
316
- #
193
+ # {include:file:docs/dsl/by_method/geometry/width.md}
317
194
  # @param value [Fixnum] The number of characters/columns.
318
195
  # @return [Fixnum]
319
196
  def width(value)
@@ -321,19 +198,9 @@ module Vedeu
321
198
  end
322
199
  alias width= width
323
200
 
324
- # Specify the starting x position (column) of the interface.
325
- #
326
- # Vedeu.geometry :some_interface do
327
- # x 7 # start on column 7.
328
- #
329
- # # start on column 8, if :other_interface changes position
330
- # # then :some_interface will too.
331
- # x { use(:other_interface).east }
332
- # # ... some code
333
- # end
334
- #
201
+ # {include:file:docs/dsl/by_method/geometry/x.md}
335
202
  # @param value [Fixnum]
336
- # @param block [Proc]
203
+ # @macro param_block
337
204
  # @return [Fixnum]
338
205
  def x(value = 1, &block)
339
206
  return model.x = block if block_given?
@@ -342,20 +209,9 @@ module Vedeu
342
209
  end
343
210
  alias x= x
344
211
 
345
- # Specify the ending x position (column) of the interface.
346
- # This value will override `width`.
347
- #
348
- # Vedeu.geometry :some_interface do
349
- # xn 37 # end at column 37.
350
- #
351
- # # when :other_interface changes position,
352
- # # :some_interface will too.
353
- # xn { use(:other_interface).right }
354
- # # ... some code
355
- # end
356
- #
212
+ # {include:file:docs/dsl/by_method/geometry/xn.md}
357
213
  # @param value [Fixnum]
358
- # @param block [Proc]
214
+ # @macro param_block
359
215
  # @return [Fixnum]
360
216
  def xn(value = 1, &block)
361
217
  return model.xn = block if block_given?
@@ -364,19 +220,9 @@ module Vedeu
364
220
  end
365
221
  alias xn= xn
366
222
 
367
- # Specify the starting y position (row/line) of the interface.
368
- #
369
- # Vedeu.geometry :some_interface do
370
- # y 4 # start at row 4
371
- #
372
- # # start on row/line 3, when :other_interface changes
373
- # # position, :some_interface will too.
374
- # y { use(:other_interface).north }
375
- # # ... some code
376
- # end
377
- #
223
+ # {include:file:docs/dsl/by_method/geometry/y.md}
378
224
  # @param value [Fixnum]
379
- # @param block [Proc]
225
+ # @macro param_block
380
226
  # @return [Fixnum]
381
227
  def y(value = 1, &block)
382
228
  return model.y = block if block_given?
@@ -385,20 +231,9 @@ module Vedeu
385
231
  end
386
232
  alias y= y
387
233
 
388
- # Specify the ending y position (row/line) of the interface.
389
- # This value will override `height`.
390
- #
391
- # Vedeu.geometry :some_interface do
392
- # yn 24 # end at row 24.
393
- #
394
- # # if :other_interface changes position, :some_interface
395
- # # will too.
396
- # yn { use(:other_interface).bottom }
397
- # # ... some code
398
- # end
399
- #
234
+ # {include:file:docs/dsl/by_method/geometry/yn.md}
400
235
  # @param value [Fixnum]
401
- # @param block [Proc]
236
+ # @macro param_block
402
237
  # @return [Fixnum]
403
238
  def yn(value = 1, &block)
404
239
  return model.yn = block if block_given?
@@ -76,13 +76,35 @@ module Vedeu
76
76
  direction != :none
77
77
  end
78
78
 
79
- # Moves the geometry down by the offset.
79
+ # Moves the geometry in the direction given by the offset also
80
+ # given.
80
81
  #
81
- # @return [Hash<Symbol => Fixnum]
82
- def down
82
+ # @return [Hash<Symbol => Hash<Symbol => Fixnum>>]
83
+ def movement
83
84
  {
84
- y: y + offset,
85
- yn: yn + offset,
85
+ down: {
86
+ y: y + offset,
87
+ yn: yn + offset,
88
+ },
89
+ left: {
90
+ x: x - offset,
91
+ xn: xn - offset,
92
+ },
93
+ none: {},
94
+ origin: {
95
+ x: 1,
96
+ xn: (xn - x + 1),
97
+ y: 1,
98
+ yn: (yn - y + 1),
99
+ },
100
+ right: {
101
+ x: x + offset,
102
+ xn: xn + offset,
103
+ },
104
+ up: {
105
+ y: y - offset,
106
+ yn: yn - offset,
107
+ },
86
108
  }
87
109
  end
88
110
 
@@ -97,46 +119,19 @@ module Vedeu
97
119
  }[direction]
98
120
  end
99
121
 
122
+ # @return [Hash<Symbol => Hash<Symbol => Fixnum>>]
123
+ def directional_move
124
+ movement.fetch(direction, {})
125
+ end
126
+
100
127
  # @macro geometry_by_name
101
128
  def geometry
102
129
  @geometry ||= Vedeu.geometries.by_name(name)
103
130
  end
104
131
 
105
- # Moves the geometry left by the offset.
106
- #
107
- # @return [Hash<Symbol => Fixnum]
108
- def left
109
- {
110
- x: x - offset,
111
- xn: xn - offset,
112
- }
113
- end
114
-
115
132
  # @return [Hash<Symbol => Boolean|String|Symbol>]
116
133
  def new_attributes
117
- geometry.attributes.merge!(unalign_unmaximise).merge!(send(direction))
118
- end
119
-
120
- # Moves the geometry to the top left of the terminal.
121
- #
122
- # @return [Hash<Symbol => Fixnum]
123
- def origin
124
- {
125
- x: 1,
126
- xn: (xn - x + 1),
127
- y: 1,
128
- yn: (yn - y + 1),
129
- }
130
- end
131
-
132
- # Moves the geometry right by the offset.
133
- #
134
- # @return [Hash<Symbol => Fixnum]
135
- def right
136
- {
137
- x: x + offset,
138
- xn: xn + offset,
139
- }
134
+ geometry.attributes.merge!(unalign_unmaximise)
140
135
  end
141
136
 
142
137
  # @return [Hash<Symbol => Boolean|Symbol]
@@ -145,17 +140,7 @@ module Vedeu
145
140
  horizontal_alignment: :none,
146
141
  maximised: false,
147
142
  vertical_alignment: :none,
148
- }
149
- end
150
-
151
- # Moves the geometry up by the offset.
152
- #
153
- # @return [Hash<Symbol => Fixnum]
154
- def up
155
- {
156
- y: y - offset,
157
- yn: yn - offset,
158
- }
143
+ }.merge(directional_move)
159
144
  end
160
145
 
161
146
  # Refresh the cursor after moving.
@@ -111,7 +111,7 @@ module Vedeu
111
111
  # the aforementioned, call the block and then reposition to this
112
112
  # location.
113
113
  #
114
- # @param block [Proc]
114
+ # @macro param_block
115
115
  # @return [String]
116
116
  # @yieldreturn [String] Returns the block wrapped in position
117
117
  # escape sequences.
@@ -9,8 +9,6 @@ module Vedeu
9
9
  #
10
10
  class Repository < Vedeu::Repositories::Repository
11
11
 
12
- singleton_class.send(:alias_method, :geometries, :repository)
13
-
14
12
  null Vedeu::Geometries::Geometry
15
13
  real Vedeu::Geometries::Geometry
16
14
 
@@ -55,7 +55,7 @@ module Vedeu
55
55
  # end
56
56
  #
57
57
  # @macro param_name
58
- # @param block [Proc]
58
+ # @macro param_block
59
59
  # @macro raise_requires_block
60
60
  # @return [Vedeu::Groups::Group]
61
61
  def self.group(name, &block)
@@ -8,8 +8,6 @@ module Vedeu
8
8
  #
9
9
  class Repository < Vedeu::Repositories::Repository
10
10
 
11
- singleton_class.send(:alias_method, :groups, :repository)
12
-
13
11
  null Vedeu::Groups::Group
14
12
  real Vedeu::Groups::Group
15
13
 
@@ -58,7 +58,7 @@ module Vedeu
58
58
  # This is also used when defining the '_global_' keymap.
59
59
  #
60
60
  # @macro param_name
61
- # @param block [Proc]
61
+ # @macro param_block
62
62
  # @macro raise_requires_block
63
63
  # @macro raise_missing_required
64
64
  # @return [Vedeu::Input::Keymap]
@@ -79,8 +79,7 @@ module Vedeu
79
79
  # The key(s) pressed. Special keys can be found in
80
80
  # {Vedeu::Input::Input#specials}. When more than one key is
81
81
  # defined, then the extras are treated as aliases.
82
- # @param block [Proc] The action to perform when this key is
83
- # pressed. Can be a method call or event triggered.
82
+ # @macro param_block
84
83
  # @macro raise_invalid_syntax
85
84
  # @return [Array] A collection containing the keys minus any
86
85
  # invalid or nil keys.
@@ -17,7 +17,7 @@ module Vedeu
17
17
  # Returns a new instance of Vedeu::Input::Key.
18
18
  #
19
19
  # @param input [String|Symbol]
20
- # @param block [Proc]
20
+ # @macro param_block
21
21
  # @macro raise_requires_block
22
22
  # @return [Vedeu::Input::Key]
23
23
  def initialize(input = nil, &block)
@@ -8,8 +8,6 @@ module Vedeu
8
8
  #
9
9
  class Repository < Vedeu::Repositories::Repository
10
10
 
11
- singleton_class.send(:alias_method, :keymaps, :repository)
12
-
13
11
  real Vedeu::Input::Keymap
14
12
 
15
13
  end # Repository
@@ -30,8 +30,7 @@ module Vedeu
30
30
  # end
31
31
  #
32
32
  # @macro param_name
33
- # @param block [Proc] A set of attributes which define the
34
- # features of the interface.
33
+ # @macro param_block
35
34
  # @macro raise_requires_block
36
35
  # @macro raise_missing_required
37
36
  # @return [Vedeu::Interfaces::Interface]
@@ -104,7 +103,7 @@ module Vedeu
104
103
 
105
104
  # Returns the client object which called the DSL method.
106
105
  #
107
- # @param block [Proc]
106
+ # @macro param_block
108
107
  # @return [Object]
109
108
  def client(&block)
110
109
  eval('self', block.binding) if block_given?
@@ -11,6 +11,9 @@ module Vedeu
11
11
 
12
12
  include Vedeu::Repositories::Model
13
13
  include Vedeu::Presentation
14
+ include Vedeu::Presentation::Colour
15
+ include Vedeu::Presentation::Position
16
+ include Vedeu::Presentation::Styles
14
17
  include Vedeu::Toggleable
15
18
 
16
19
  # @!attribute [rw] client
@@ -9,6 +9,9 @@ module Vedeu
9
9
  class Null < Vedeu::Null::Generic
10
10
 
11
11
  include Vedeu::Presentation
12
+ include Vedeu::Presentation::Colour
13
+ include Vedeu::Presentation::Position
14
+ include Vedeu::Presentation::Styles
12
15
 
13
16
  # @!attribute [r] attributes
14
17
  # @return [String]