vedeu 0.8.15 → 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl/by_method/clear_by_group.md +4 -1
- data/docs/dsl/by_method/clear_by_name.md +4 -1
- data/docs/dsl/by_method/clear_content_by_name.md +4 -1
- data/docs/dsl/by_method/documents.md +5 -1
- data/docs/dsl/by_method/geometry/align.md +54 -8
- data/examples/dsl_alignment.rb +9 -9
- data/examples/dsl_colours.rb +1 -1
- data/examples/dsl_editor.rb +1 -1
- data/examples/dsl_hello_worlds.rb +2 -2
- data/lib/vedeu.rb +7 -1
- data/lib/vedeu/borders/dsl.rb +1 -2
- data/lib/vedeu/borders/refresh.rb +1 -2
- data/lib/vedeu/borders/title.rb +1 -1
- data/lib/vedeu/buffers/refresh.rb +1 -2
- data/lib/vedeu/cells/support/html.rb +1 -1
- data/lib/vedeu/coercers/chars.rb +1 -1
- data/lib/vedeu/coercers/coercer.rb +0 -3
- data/lib/vedeu/coercers/colour.rb +1 -1
- data/lib/vedeu/coercers/editor_line.rb +1 -1
- data/lib/vedeu/coercers/lines.rb +1 -1
- data/lib/vedeu/colours/backgrounds.rb +2 -0
- data/lib/vedeu/colours/foregrounds.rb +2 -0
- data/lib/vedeu/cursors/move.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +1 -2
- data/lib/vedeu/dsl/border.rb +1 -4
- data/lib/vedeu/dsl/geometry.rb +2 -6
- data/lib/vedeu/dsl/use.rb +1 -2
- data/lib/vedeu/dsl/view.rb +5 -7
- data/lib/vedeu/editor/cropper.rb +1 -1
- data/lib/vedeu/editor/editor.rb +1 -1
- data/lib/vedeu/events/event.rb +3 -4
- data/lib/vedeu/events/trigger.rb +1 -2
- data/lib/vedeu/geometries/area/area.rb +1 -1
- data/lib/vedeu/groups/clear.rb +3 -8
- data/lib/vedeu/groups/dsl.rb +2 -2
- data/lib/vedeu/groups/refresh.rb +2 -3
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/dsl.rb +1 -2
- data/lib/vedeu/input/mapper.rb +2 -2
- data/lib/vedeu/interfaces/clear.rb +3 -14
- data/lib/vedeu/interfaces/dsl.rb +10 -15
- data/lib/vedeu/interfaces/repository.rb +3 -3
- data/lib/vedeu/menus/dsl.rb +1 -2
- data/lib/vedeu/models/focus.rb +4 -5
- data/lib/vedeu/models/toggleable.rb +8 -7
- data/lib/vedeu/output/compressor_cache.rb +15 -4
- data/lib/vedeu/output/refresh.rb +3 -3
- data/lib/vedeu/output/viewport.rb +4 -4
- data/lib/vedeu/plugins/plugin.rb +1 -1
- data/lib/vedeu/plugins/plugins.rb +2 -2
- data/lib/vedeu/repositories/collection.rb +2 -2
- data/lib/vedeu/repositories/repository.rb +6 -6
- data/lib/vedeu/repositories/store.rb +1 -1
- data/lib/vedeu/sentence.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/chars.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +6 -0
- data/test/lib/vedeu/coercers/colour_test.rb +3 -1
- data/test/lib/vedeu/coercers/editor_line_test.rb +2 -0
- data/test/lib/vedeu/coercers/lines_test.rb +4 -0
- data/test/lib/vedeu/dsl/border_test.rb +13 -0
- data/test/lib/vedeu/dsl/geometry_test.rb +15 -0
- data/test/lib/vedeu/interfaces/repository_test.rb +1 -1
- data/test/lib/vedeu/models/toggleable_test.rb +6 -0
- data/test/lib/vedeu/output/refresh_test.rb +6 -6
- data/test/lib/vedeu/repositories/model_test.rb +6 -0
- data/test/lib/vedeu/repositories/registerable_test.rb +6 -0
- data/test/lib/vedeu/views/value_test.rb +6 -0
- data/test/support/examples/hello_world.rb +1 -1
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 805fd2db1418da4e71a147f7e0c3abffe83cbca0
|
4
|
+
data.tar.gz: 5ae3a8f1f58bbce6b6581063d766f8b67cb87925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b85555d260e7e07638b1239abb46f97c99929539f8bac9efebe7b4239c72d47bc3941012826595806bf5b195e6a6421a5cd85b20affdc89f443ba68608c69c0
|
7
|
+
data.tar.gz: c8906b96488c8158013fd89a5f5faa4a7f77c8978a199e994f059de9735b341e35d19647c810af8a98a861c745146c46dbcc101543444c96948c17e401a0b326
|
@@ -3,11 +3,57 @@ terminal.
|
|
3
3
|
|
4
4
|
An error will be raised if:
|
5
5
|
|
6
|
-
- When the vertical is not given.
|
7
|
-
- When the horizontal is not given.
|
8
|
-
- When the horizontal is given (and not :none) and the width
|
9
|
-
given.
|
10
|
-
- When the vertical is given (and not :none) and the height
|
11
|
-
given.
|
12
|
-
|
13
|
-
|
6
|
+
- When the vertical argument is not given.
|
7
|
+
- When the horizontal argument is not given.
|
8
|
+
- When the horizontal argument is given (and not :none) and the width
|
9
|
+
argument is not given.
|
10
|
+
- When the vertical argument is given (and not :none) and the height
|
11
|
+
argument is not given.
|
12
|
+
|
13
|
+
Aligning the view with the bottom of the terminal:
|
14
|
+
|
15
|
+
# Vedeu.geometry :my_interface do
|
16
|
+
align vertical: :bottom
|
17
|
+
|
18
|
+
# ...
|
19
|
+
# end
|
20
|
+
|
21
|
+
Aligning the view in the centre (horizontally) of the terminal:
|
22
|
+
|
23
|
+
# Vedeu.geometry :my_interface do
|
24
|
+
align horizontal: :centre
|
25
|
+
|
26
|
+
# ...
|
27
|
+
# end
|
28
|
+
|
29
|
+
Aligning the view with the left of the terminal:
|
30
|
+
|
31
|
+
# Vedeu.geometry :my_interface do
|
32
|
+
align horizontal: :left
|
33
|
+
|
34
|
+
# ...
|
35
|
+
# end
|
36
|
+
|
37
|
+
Aligning the view in the middle (vertically) of the terminal:
|
38
|
+
|
39
|
+
# Vedeu.geometry :my_interface do
|
40
|
+
align vertical: :middle
|
41
|
+
|
42
|
+
# ...
|
43
|
+
# end
|
44
|
+
|
45
|
+
Aligning the view with the right of the terminal:
|
46
|
+
|
47
|
+
# Vedeu.geometry :my_interface do
|
48
|
+
align horizontal: :right
|
49
|
+
|
50
|
+
# ...
|
51
|
+
# end
|
52
|
+
|
53
|
+
Aligning the view with the top of the terminal:
|
54
|
+
|
55
|
+
# Vedeu.geometry :my_interface do
|
56
|
+
align vertical: :top
|
57
|
+
|
58
|
+
# ...
|
59
|
+
# end
|
data/examples/dsl_alignment.rb
CHANGED
@@ -23,7 +23,7 @@ class AlignmentApp
|
|
23
23
|
title 'Top Left'
|
24
24
|
end
|
25
25
|
geometry do
|
26
|
-
align
|
26
|
+
align vertical: :top, horizontal: :left, width: 20, height: 4
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ class AlignmentApp
|
|
32
32
|
title 'Top Centre'
|
33
33
|
end
|
34
34
|
geometry do
|
35
|
-
align
|
35
|
+
align vertical: :top, horizontal: :centre, width: 20, height: 4
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -41,7 +41,7 @@ class AlignmentApp
|
|
41
41
|
title 'Top Right'
|
42
42
|
end
|
43
43
|
geometry do
|
44
|
-
align
|
44
|
+
align vertical: :top, horizontal: :right, width: 20, height: 4
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ class AlignmentApp
|
|
50
50
|
title 'Middle Left'
|
51
51
|
end
|
52
52
|
geometry do
|
53
|
-
align
|
53
|
+
align vertical: :middle, horizontal: :left, width: 20, height: 4
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -59,7 +59,7 @@ class AlignmentApp
|
|
59
59
|
title 'Middle Centre'
|
60
60
|
end
|
61
61
|
geometry do
|
62
|
-
align
|
62
|
+
align vertical: :middle, horizontal: :centre, width: 20, height: 4
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -68,7 +68,7 @@ class AlignmentApp
|
|
68
68
|
title 'Middle Right'
|
69
69
|
end
|
70
70
|
geometry do
|
71
|
-
align
|
71
|
+
align vertical: :middle, horizontal: :right, width: 20, height: 4
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -77,7 +77,7 @@ class AlignmentApp
|
|
77
77
|
title 'Bottom Left'
|
78
78
|
end
|
79
79
|
geometry do
|
80
|
-
align
|
80
|
+
align vertical: :bottom, horizontal: :left, width: 20, height: 4
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -86,7 +86,7 @@ class AlignmentApp
|
|
86
86
|
title 'Bottom Centre'
|
87
87
|
end
|
88
88
|
geometry do
|
89
|
-
align
|
89
|
+
align vertical: :bottom, horizontal: :centre, width: 20, height: 4
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -95,7 +95,7 @@ class AlignmentApp
|
|
95
95
|
title 'Bottom Right'
|
96
96
|
end
|
97
97
|
geometry do
|
98
|
-
align
|
98
|
+
align vertical: :bottom, horizontal: :right, width: 20, height: 4
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
data/examples/dsl_colours.rb
CHANGED
data/examples/dsl_editor.rb
CHANGED
@@ -31,7 +31,7 @@ class HelloWorldsApp
|
|
31
31
|
background '#000000'
|
32
32
|
foreground '#00ff00'
|
33
33
|
geometry do
|
34
|
-
align
|
34
|
+
align vertical: :middle, horizontal: :centre, width: 24, height: 5
|
35
35
|
end
|
36
36
|
keymap do
|
37
37
|
key('q') { Vedeu.exit }
|
@@ -61,7 +61,7 @@ class HelloWorldsApp
|
|
61
61
|
Vedeu.render do
|
62
62
|
view :hello do
|
63
63
|
geometry do
|
64
|
-
align
|
64
|
+
align vertical: :middle, horizontal: :centre, width: (24 + 2), height: (5 + 2)
|
65
65
|
end
|
66
66
|
border do
|
67
67
|
colour foreground: ["#00ff00", "#000033", "#cddc39", "#03a9f4"].sample
|
data/lib/vedeu.rb
CHANGED
@@ -55,7 +55,7 @@ end # Vedeu
|
|
55
55
|
# Provide additional behaviour to a class or module.
|
56
56
|
#
|
57
57
|
# @param klass [Class]
|
58
|
-
# @return [
|
58
|
+
# @return [Class] Returns the klass parameter.
|
59
59
|
#
|
60
60
|
# @!macro [new] module_instance_methods
|
61
61
|
# Provide additional behaviour as instance methods to the including
|
@@ -65,5 +65,11 @@ end # Vedeu
|
|
65
65
|
# Provide additional behaviour as singleton methods to the including
|
66
66
|
# class or module.
|
67
67
|
#
|
68
|
+
# @!macro [new] param_name
|
69
|
+
# @param name [NilClass|Symbol|String] The name of the model or
|
70
|
+
# target model to act upon. May default to `Vedeu.focus`.
|
71
|
+
#
|
72
|
+
# @!macro [new] return_name
|
73
|
+
# @return [NilClass|Symbol|String]
|
68
74
|
|
69
75
|
require 'vedeu/all'
|
data/lib/vedeu/borders/dsl.rb
CHANGED
@@ -14,8 +14,7 @@ module Vedeu
|
|
14
14
|
include Vedeu::DSL::Use
|
15
15
|
|
16
16
|
# {include:file:docs/dsl/by_method/border.md}
|
17
|
-
# @
|
18
|
-
# to which this border belongs.
|
17
|
+
# @macro param_name
|
19
18
|
# @param block [Proc]
|
20
19
|
# @macro raise_requires_block
|
21
20
|
# @macro raise_missing_required
|
@@ -62,8 +62,7 @@ module Vedeu
|
|
62
62
|
|
63
63
|
# Returns a new instance of Vedeu::Borders::Refresh.
|
64
64
|
#
|
65
|
-
# @
|
66
|
-
# border to be refreshed. Defaults to `Vedeu.focus`.
|
65
|
+
# @macro param_name
|
67
66
|
# @return [Vedeu::Borders::Refresh]
|
68
67
|
def initialize(name = Vedeu.focus)
|
69
68
|
@name = present?(name) ? name : Vedeu.focus
|
data/lib/vedeu/borders/title.rb
CHANGED
@@ -24,7 +24,7 @@ module Vedeu
|
|
24
24
|
# Returns a new instance of Vedeu::Borders::Title or
|
25
25
|
# Vedeu::Borders::Caption.
|
26
26
|
#
|
27
|
-
# @
|
27
|
+
# @macro param_name
|
28
28
|
# @param value [String|Vedeu::Borders::Title|
|
29
29
|
# @param horizontal [Array<Vedeu::Cells::Horizontal>]
|
30
30
|
# Vedeu::Borders::Caption]
|
@@ -30,8 +30,7 @@ module Vedeu
|
|
30
30
|
|
31
31
|
# Return a new instance of Vedeu::Buffers::Refresh.
|
32
32
|
#
|
33
|
-
# @
|
34
|
-
# be refreshed. Defaults to `Vedeu.focus`.
|
33
|
+
# @macro param_name
|
35
34
|
# @param options [Hash<Symbol => Boolean>]
|
36
35
|
# @option options content_only [Boolean]
|
37
36
|
# @return [Vedeu::Buffers::Refresh]
|
data/lib/vedeu/coercers/chars.rb
CHANGED
@@ -28,7 +28,6 @@ module Vedeu
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# @macro raise_not_implemented
|
31
|
-
# @return [void]
|
32
31
|
def coerce
|
33
32
|
raise Vedeu::Error::NotImplemented, 'Subclasses implement this.'
|
34
33
|
end
|
@@ -47,14 +46,12 @@ module Vedeu
|
|
47
46
|
end
|
48
47
|
|
49
48
|
# @macro raise_fatal
|
50
|
-
# @return [void]
|
51
49
|
def incoercible!
|
52
50
|
raise Vedeu::Error::Fatal,
|
53
51
|
"Vedeu cannot coerce a '#{value.class.name}' into a '#{klass}'."
|
54
52
|
end
|
55
53
|
|
56
54
|
# @macro raise_not_implemented
|
57
|
-
# @return [Class]
|
58
55
|
def klass
|
59
56
|
raise Vedeu::Error::NotImplemented, 'Subclasses implement this.'
|
60
57
|
end
|
data/lib/vedeu/coercers/lines.rb
CHANGED
data/lib/vedeu/cursors/move.rb
CHANGED
@@ -39,8 +39,7 @@ module Vedeu
|
|
39
39
|
|
40
40
|
# Returns a new instance of Vedeu::Cursors::Refresh.
|
41
41
|
#
|
42
|
-
# @
|
43
|
-
# cursor to be refreshed. Defaults to `Vedeu.focus`.
|
42
|
+
# @macro param_name
|
44
43
|
# @return [Vedeu::Cursors::Refresh]
|
45
44
|
def initialize(name)
|
46
45
|
@name = name
|
data/lib/vedeu/dsl/border.rb
CHANGED
@@ -32,10 +32,7 @@ module Vedeu
|
|
32
32
|
# end
|
33
33
|
# end
|
34
34
|
#
|
35
|
-
# @
|
36
|
-
# is already provided when we define the interface or view,
|
37
|
-
# setting it here is just mirroring functionality of
|
38
|
-
# {Vedeu::DSL::Border::SingletonMethods.border}.
|
35
|
+
# @macro param_name
|
39
36
|
# @param block [Proc]
|
40
37
|
# @macro raise_requires_block
|
41
38
|
# @macro raise_missing_required
|
data/lib/vedeu/dsl/geometry.rb
CHANGED
@@ -14,8 +14,7 @@ module Vedeu
|
|
14
14
|
module SingletonMethods
|
15
15
|
|
16
16
|
# {include:file:docs/dsl/by_method/geometry.md}
|
17
|
-
# @
|
18
|
-
# view to which this geometry belongs.
|
17
|
+
# @macro param_name
|
19
18
|
# @param block [Proc]
|
20
19
|
# @macro raise_requires_block
|
21
20
|
# @macro raise_missing_required
|
@@ -46,10 +45,7 @@ module Vedeu
|
|
46
45
|
module InstanceMethods
|
47
46
|
|
48
47
|
# {include:file:docs/dsl/by_method/geometry.md}
|
49
|
-
# @
|
50
|
-
# is already provided when we define the interface or view,
|
51
|
-
# setting it here is just mirroring functionality of
|
52
|
-
# {Vedeu::DSL::Geometry::SingletonMethods#geometry}.
|
48
|
+
# @macro param_name
|
53
49
|
# @param block [Proc]
|
54
50
|
# @macro raise_requires_block
|
55
51
|
# @macro raise_missing_required
|
data/lib/vedeu/dsl/use.rb
CHANGED
@@ -29,8 +29,7 @@ module Vedeu
|
|
29
29
|
# exception may be raised, or the request for an attribute
|
30
30
|
# may raise a NoMethodError exception.
|
31
31
|
#
|
32
|
-
# @
|
33
|
-
# value you wish to use.
|
32
|
+
# @macro param_name
|
34
33
|
# @raise
|
35
34
|
# [Vedeu::Error::ModelNotFound|Vedeu::Error::NoMethodError]
|
36
35
|
# The model or attribute cannot be found.
|