vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
data/lib/vedeu/borders/border.rb
CHANGED
@@ -104,8 +104,8 @@ module Vedeu
|
|
104
104
|
# border is to be shown for this interface.
|
105
105
|
# @option attributes horizontal [String] The horizontal border
|
106
106
|
# character.
|
107
|
-
# @option attributes name [String] The name of the
|
108
|
-
# which this border relates.
|
107
|
+
# @option attributes name [String|Symbol] The name of the
|
108
|
+
# interface to which this border relates.
|
109
109
|
# @option attributes style [Vedeu::Presentation::Style]
|
110
110
|
# @option attributes show_bottom [Boolean] Indicate whether the
|
111
111
|
# bottom border is to be shown.
|
data/lib/vedeu/borders/dsl.rb
CHANGED
@@ -12,12 +12,12 @@ module Vedeu
|
|
12
12
|
|
13
13
|
# Specify the border of an interface or view with a simple DSL.
|
14
14
|
#
|
15
|
-
# Vedeu.border
|
15
|
+
# Vedeu.border :some_interface do
|
16
16
|
# # ...
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# @param name [String] The name of the interface or view
|
20
|
-
# which this border belongs.
|
19
|
+
# @param name [String|Symbol] The name of the interface or view
|
20
|
+
# to which this border belongs.
|
21
21
|
# @param block [Proc]
|
22
22
|
# @raise [Vedeu::Error::RequiresBlock]
|
23
23
|
# @return [Vedeu::Borders::Border]
|
@@ -27,20 +27,10 @@ module Vedeu
|
|
27
27
|
Vedeu::Borders::Border.build(enabled: true, name: name, &block).store
|
28
28
|
end
|
29
29
|
|
30
|
-
# Returns an instance of Borders::DSL.
|
31
|
-
#
|
32
|
-
# @param model [Vedeu::Borders::Border]
|
33
|
-
# @param client [Object]
|
34
|
-
# @return [Vedeu::Borders::DSL]
|
35
|
-
def initialize(model, client = nil)
|
36
|
-
@model = model
|
37
|
-
@client = client
|
38
|
-
end
|
39
|
-
|
40
30
|
# Set the character to be used to draw the bottom left corner of
|
41
31
|
# the border.
|
42
32
|
#
|
43
|
-
# Vedeu.border
|
33
|
+
# Vedeu.border :border_demo do
|
44
34
|
# bottom_left '+'
|
45
35
|
# # ... some code
|
46
36
|
# end
|
@@ -56,7 +46,7 @@ module Vedeu
|
|
56
46
|
# Set the character to be used to draw the bottom right corner
|
57
47
|
# of the border.
|
58
48
|
#
|
59
|
-
# Vedeu.border
|
49
|
+
# Vedeu.border :border_demo do
|
60
50
|
# bottom_right '+'
|
61
51
|
# # ... some code
|
62
52
|
# end
|
@@ -71,7 +61,7 @@ module Vedeu
|
|
71
61
|
|
72
62
|
# Disable the border:
|
73
63
|
#
|
74
|
-
# Vedeu.border
|
64
|
+
# Vedeu.border :border_demo do
|
75
65
|
# disable!
|
76
66
|
# # ... some other code (will be ignored)
|
77
67
|
# end
|
@@ -92,7 +82,7 @@ module Vedeu
|
|
92
82
|
# (Borders are enabled by default when defined for an
|
93
83
|
# interface).
|
94
84
|
#
|
95
|
-
# Vedeu.border
|
85
|
+
# Vedeu.border :border_demo do
|
96
86
|
# enable!
|
97
87
|
# # ... some code
|
98
88
|
# end
|
@@ -112,7 +102,7 @@ module Vedeu
|
|
112
102
|
# Set the character to be used to draw a horizontal part of the
|
113
103
|
# border.
|
114
104
|
#
|
115
|
-
# Vedeu.border
|
105
|
+
# Vedeu.border :border_demo do
|
116
106
|
# horizontal '-'
|
117
107
|
# # ... some code
|
118
108
|
# end
|
@@ -127,7 +117,7 @@ module Vedeu
|
|
127
117
|
|
128
118
|
# Enable/disable the bottom border.
|
129
119
|
#
|
130
|
-
# Vedeu.border
|
120
|
+
# Vedeu.border :border_demo do
|
131
121
|
# bottom true # or...
|
132
122
|
# bottom false # or...
|
133
123
|
# hide_bottom! # or...
|
@@ -162,7 +152,7 @@ module Vedeu
|
|
162
152
|
|
163
153
|
# Enable/disable the left border.
|
164
154
|
#
|
165
|
-
# Vedeu.border
|
155
|
+
# Vedeu.border :border_demo do
|
166
156
|
# left true # or...
|
167
157
|
# left false # or...
|
168
158
|
# hide_left! # or...
|
@@ -197,7 +187,7 @@ module Vedeu
|
|
197
187
|
|
198
188
|
# Enable/disable the right border.
|
199
189
|
#
|
200
|
-
# Vedeu.border
|
190
|
+
# Vedeu.border :border_demo do
|
201
191
|
# right true # or...
|
202
192
|
# right false # or...
|
203
193
|
# hide_right! # or...
|
@@ -233,7 +223,7 @@ module Vedeu
|
|
233
223
|
# If you have you are showing a top border, you could add a
|
234
224
|
# title.
|
235
225
|
#
|
236
|
-
# Vedeu.border
|
226
|
+
# Vedeu.border :border_demo do
|
237
227
|
# title 'My Cool Title'
|
238
228
|
# # ... some code
|
239
229
|
# end
|
@@ -252,7 +242,7 @@ module Vedeu
|
|
252
242
|
# If you have you are showing a bottom border, you could add a
|
253
243
|
# caption.
|
254
244
|
#
|
255
|
-
# Vedeu.border
|
245
|
+
# Vedeu.border :border_demo do
|
256
246
|
# caption 'My Cool Caption'
|
257
247
|
# # ... some code
|
258
248
|
# end
|
@@ -270,7 +260,7 @@ module Vedeu
|
|
270
260
|
|
271
261
|
# Enable/disable the top border.
|
272
262
|
#
|
273
|
-
# Vedeu.border
|
263
|
+
# Vedeu.border :border_demo do
|
274
264
|
# top true # or...
|
275
265
|
# top false # or...
|
276
266
|
# hide_top! # or...
|
@@ -306,7 +296,7 @@ module Vedeu
|
|
306
296
|
# Set the character to be used to draw the top left corner of
|
307
297
|
# the border.
|
308
298
|
#
|
309
|
-
# Vedeu.border
|
299
|
+
# Vedeu.border :border_demo do
|
310
300
|
# top_left '+'
|
311
301
|
# # ... some code
|
312
302
|
# end
|
@@ -322,7 +312,7 @@ module Vedeu
|
|
322
312
|
# Set the character to be used to draw the top right corner of
|
323
313
|
# the border.
|
324
314
|
#
|
325
|
-
# Vedeu.border
|
315
|
+
# Vedeu.border :border_demo do
|
326
316
|
# top_right '+'
|
327
317
|
# # ... some code
|
328
318
|
# end
|
@@ -338,7 +328,7 @@ module Vedeu
|
|
338
328
|
# Set the character to be used to draw a vertical part of the
|
339
329
|
# border.
|
340
330
|
#
|
341
|
-
# Vedeu.border
|
331
|
+
# Vedeu.border :border_demo do
|
342
332
|
# vertical '|'
|
343
333
|
# # ... some code
|
344
334
|
# end
|
@@ -355,4 +345,8 @@ module Vedeu
|
|
355
345
|
|
356
346
|
end # DSL
|
357
347
|
|
348
|
+
# @!method border
|
349
|
+
# @see Vedeu::Borders::DSL.border
|
350
|
+
def_delegators Vedeu::Borders::DSL, :border
|
351
|
+
|
358
352
|
end # Vedeu
|
data/lib/vedeu/borders/null.rb
CHANGED
@@ -8,13 +8,13 @@ module Vedeu
|
|
8
8
|
class Null
|
9
9
|
|
10
10
|
# @!attribute [r] name
|
11
|
-
# @return [String|NilClass]
|
11
|
+
# @return [String|Symbol|NilClass]
|
12
12
|
attr_reader :name
|
13
13
|
|
14
14
|
# Returns a new instance of Vedeu::Borders::Null.
|
15
15
|
#
|
16
16
|
# @param attributes [Hash<Symbol => void>]
|
17
|
-
# @option attributes name [String|NilClass]
|
17
|
+
# @option attributes name [String|Symbol|NilClass]
|
18
18
|
# @return [Vedeu::Borders::Null]
|
19
19
|
def initialize(attributes = {})
|
20
20
|
@attributes = attributes
|
@@ -45,24 +45,11 @@ module Vedeu
|
|
45
45
|
end
|
46
46
|
alias_method :yn, :byn
|
47
47
|
|
48
|
-
# The null border should not be enabled, so that named geometry
|
49
|
-
# or null geometry is used.
|
50
|
-
#
|
51
|
-
# @return [FalseClass]
|
52
|
-
def enabled?
|
53
|
-
false
|
54
|
-
end
|
55
|
-
|
56
48
|
# @return [Fixnum]
|
57
49
|
def height
|
58
50
|
(by..byn).size
|
59
51
|
end
|
60
52
|
|
61
|
-
# @return [Boolean]
|
62
|
-
def null?
|
63
|
-
true
|
64
|
-
end
|
65
|
-
|
66
53
|
# @return [Array]
|
67
54
|
def render
|
68
55
|
[]
|
data/lib/vedeu/borders/render.rb
CHANGED
@@ -16,4 +16,13 @@ module Vedeu
|
|
16
16
|
|
17
17
|
end # Borders
|
18
18
|
|
19
|
+
# Manipulate the repository of borders.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Vedeu.borders
|
23
|
+
#
|
24
|
+
# @!method borders
|
25
|
+
# @return [Vedeu::Borders::Repository]
|
26
|
+
def_delegators Vedeu::Borders::Repository, :borders
|
27
|
+
|
19
28
|
end # Vedeu
|
data/lib/vedeu/buffers/buffer.rb
CHANGED
@@ -37,8 +37,8 @@ module Vedeu
|
|
37
37
|
# Return a new instance of Buffer. Generally a Buffer is
|
38
38
|
# initialized with only a 'name' and 'back' parameter.
|
39
39
|
#
|
40
|
-
# @option attributes name [String] The name of the
|
41
|
-
# which the buffer belongs.
|
40
|
+
# @option attributes name [String|Symbol] The name of the
|
41
|
+
# interface for which the buffer belongs.
|
42
42
|
# @option attributes back [Vedeu::Views::View]
|
43
43
|
# @option attributes front [Vedeu::Views::View]
|
44
44
|
# @option attributes previous [Vedeu::Views::View]
|
data/lib/vedeu/buffers/null.rb
CHANGED
@@ -5,37 +5,7 @@ module Vedeu
|
|
5
5
|
# Provides a non-existent Vedeu::Buffers::Buffer that acts like
|
6
6
|
# the real thing, but does nothing.
|
7
7
|
#
|
8
|
-
class Null
|
9
|
-
|
10
|
-
# @!attribute [r] name
|
11
|
-
# @return [String]
|
12
|
-
attr_reader :name
|
13
|
-
|
14
|
-
# Returns a new instance of Vedeu::Buffers::Null.
|
15
|
-
#
|
16
|
-
# @param attributes [Hash<Symbol => void>]
|
17
|
-
# @option attributes name [String|NilClass]
|
18
|
-
# @return [Vedeu::Buffers::Null]
|
19
|
-
def initialize(attributes = {})
|
20
|
-
@attributes = attributes
|
21
|
-
@name = @attributes[:name]
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [NilClass]
|
25
|
-
def null(*)
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
alias_method :add, :null
|
29
|
-
alias_method :clear, :null
|
30
|
-
alias_method :hide, :null
|
31
|
-
alias_method :render, :null
|
32
|
-
alias_method :show, :null
|
33
|
-
alias_method :toggle, :null
|
34
|
-
|
35
|
-
# @return [Boolean]
|
36
|
-
def null?
|
37
|
-
true
|
38
|
-
end
|
8
|
+
class Null < Vedeu::Null::Generic
|
39
9
|
|
40
10
|
end # Null
|
41
11
|
|
@@ -11,22 +11,22 @@ module Vedeu
|
|
11
11
|
|
12
12
|
include Vedeu::Common
|
13
13
|
|
14
|
-
# @param
|
15
|
-
#
|
16
|
-
# @return [Array|Vedeu::Error::ModelNotFound]
|
14
|
+
# @param (see #initialize)
|
15
|
+
# @return (see #by_name)
|
17
16
|
def self.by_name(name)
|
18
17
|
new(name).by_name
|
19
18
|
end
|
20
19
|
|
21
20
|
# Return a new instance of Vedeu::Buffers::Refresh.
|
22
21
|
#
|
23
|
-
# @param name [String]
|
22
|
+
# @param name [String|Symbol] The name of the interface to be refreshed
|
23
|
+
# using the named buffer.
|
24
24
|
# @return [Vedeu::Buffers::Refresh]
|
25
25
|
def initialize(name)
|
26
26
|
@name = name
|
27
27
|
end
|
28
28
|
|
29
|
-
# @return [
|
29
|
+
# @return [Array|Vedeu::Error::ModelNotFound]
|
30
30
|
def by_name
|
31
31
|
Vedeu.timer("Refresh Buffer: '#{buffer_name}'") do
|
32
32
|
Vedeu.buffers.by_name(buffer_name).render
|
@@ -35,15 +35,15 @@ module Vedeu
|
|
35
35
|
|
36
36
|
protected
|
37
37
|
|
38
|
-
#
|
39
|
-
# @return [String]
|
38
|
+
# @!attribute [r] name
|
39
|
+
# @return [String|Symbol]
|
40
40
|
attr_reader :name
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
44
|
# @raise [Vedeu::Error::MissingRequired] When the name is empty
|
45
45
|
# or nil.
|
46
|
-
# @return [String]
|
46
|
+
# @return [String|Symbol]
|
47
47
|
def buffer_name
|
48
48
|
return name if present?(name)
|
49
49
|
|
@@ -21,4 +21,13 @@ module Vedeu
|
|
21
21
|
|
22
22
|
end # Buffers
|
23
23
|
|
24
|
+
# Manipulate the repository of buffers.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Vedeu.buffers
|
28
|
+
#
|
29
|
+
# @!method buffers
|
30
|
+
# @return [Vedeu::Buffers::Repository]
|
31
|
+
def_delegators Vedeu::Buffers::Repository, :buffers
|
32
|
+
|
24
33
|
end # Vedeu
|
@@ -6,6 +6,11 @@ module Vedeu
|
|
6
6
|
#
|
7
7
|
class Backgrounds < Vedeu::Colours::Repository
|
8
8
|
|
9
|
+
# Manipulate the repository of background colours.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Vedeu.background_colours
|
13
|
+
#
|
9
14
|
# @return [Vedeu::Colours::Backgrounds]
|
10
15
|
# @see Vedeu::Repositories::Repository
|
11
16
|
def self.background_colours
|
@@ -16,4 +21,8 @@ module Vedeu
|
|
16
21
|
|
17
22
|
end # Colours
|
18
23
|
|
24
|
+
# @!method background_colours
|
25
|
+
# @return [Vedeu::Colours::Backgrounds]
|
26
|
+
def_delegators Vedeu::Colours::Backgrounds, :background_colours
|
27
|
+
|
19
28
|
end # Vedeu
|
data/lib/vedeu/colours/colour.rb
CHANGED
@@ -46,7 +46,7 @@ module Vedeu
|
|
46
46
|
attr_reader :foreground
|
47
47
|
|
48
48
|
# @param value [Vedeu::Colours::Colour|Hash<Symbol => void>]
|
49
|
-
# @return [
|
49
|
+
# @return [Vedeu::Colours::Colour]
|
50
50
|
def self.coerce(value)
|
51
51
|
return value if value.is_a?(self)
|
52
52
|
return new unless value.is_a?(Hash)
|
@@ -6,6 +6,11 @@ module Vedeu
|
|
6
6
|
#
|
7
7
|
class Foregrounds < Vedeu::Colours::Repository
|
8
8
|
|
9
|
+
# Manipulate the repository of foreground colours.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Vedeu.foreground_colours
|
13
|
+
#
|
9
14
|
# @return [Vedeu::Colours::Foregrounds]
|
10
15
|
# @see Vedeu::Repositories::Repository
|
11
16
|
def self.foreground_colours
|
@@ -16,4 +21,8 @@ module Vedeu
|
|
16
21
|
|
17
22
|
end # Colours
|
18
23
|
|
24
|
+
# @!method foreground_colours
|
25
|
+
# @return [Vedeu::Colours::Foregrounds]
|
26
|
+
def_delegators Vedeu::Colours::Foregrounds, :foreground_colours
|
27
|
+
|
19
28
|
end # Vedeu
|
data/lib/vedeu/common.rb
CHANGED
@@ -4,6 +4,15 @@ module Vedeu
|
|
4
4
|
#
|
5
5
|
module Common
|
6
6
|
|
7
|
+
# Returns a boolean indicating whether a variable is nil or empty.
|
8
|
+
#
|
9
|
+
# @param variable [String|Symbol|Array|Fixnum] The variable to
|
10
|
+
# check.
|
11
|
+
# @return [Boolean]
|
12
|
+
def absent?(variable)
|
13
|
+
!present?(variable)
|
14
|
+
end
|
15
|
+
|
7
16
|
# Removes the module part from the expression in the string.
|
8
17
|
#
|
9
18
|
# @example
|
@@ -17,6 +26,19 @@ module Vedeu
|
|
17
26
|
klass[(klass.rindex('::') + 2)..-1]
|
18
27
|
end
|
19
28
|
|
29
|
+
# Returns a boolean indicating whether a variable has a useful
|
30
|
+
# value.
|
31
|
+
#
|
32
|
+
# @param variable [String|Symbol|Array|Fixnum] The variable to
|
33
|
+
# check.
|
34
|
+
# @return [Boolean]
|
35
|
+
def present?(variable)
|
36
|
+
return true if variable.is_a?(Fixnum)
|
37
|
+
return true unless variable.nil? || variable.empty?
|
38
|
+
|
39
|
+
false
|
40
|
+
end
|
41
|
+
|
20
42
|
# Converts a class name to a lowercase snake case string.
|
21
43
|
#
|
22
44
|
# @example
|
@@ -35,19 +57,6 @@ module Vedeu
|
|
35
57
|
name
|
36
58
|
end
|
37
59
|
|
38
|
-
# Returns a boolean indicating whether a variable has a useful
|
39
|
-
# value.
|
40
|
-
#
|
41
|
-
# @param variable [String|Symbol|Array|Fixnum] The variable to
|
42
|
-
# check.
|
43
|
-
# @return [Boolean]
|
44
|
-
def present?(variable)
|
45
|
-
return true if variable.is_a?(Fixnum)
|
46
|
-
return true unless variable.nil? || variable.empty?
|
47
|
-
|
48
|
-
false
|
49
|
-
end
|
50
|
-
|
51
60
|
end # Common
|
52
61
|
|
53
62
|
end # Vedeu
|