vedeu 0.8.15 → 0.8.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl/by_method/clear_by_group.md +4 -1
  3. data/docs/dsl/by_method/clear_by_name.md +4 -1
  4. data/docs/dsl/by_method/clear_content_by_name.md +4 -1
  5. data/docs/dsl/by_method/documents.md +5 -1
  6. data/docs/dsl/by_method/geometry/align.md +54 -8
  7. data/examples/dsl_alignment.rb +9 -9
  8. data/examples/dsl_colours.rb +1 -1
  9. data/examples/dsl_editor.rb +1 -1
  10. data/examples/dsl_hello_worlds.rb +2 -2
  11. data/lib/vedeu.rb +7 -1
  12. data/lib/vedeu/borders/dsl.rb +1 -2
  13. data/lib/vedeu/borders/refresh.rb +1 -2
  14. data/lib/vedeu/borders/title.rb +1 -1
  15. data/lib/vedeu/buffers/refresh.rb +1 -2
  16. data/lib/vedeu/cells/support/html.rb +1 -1
  17. data/lib/vedeu/coercers/chars.rb +1 -1
  18. data/lib/vedeu/coercers/coercer.rb +0 -3
  19. data/lib/vedeu/coercers/colour.rb +1 -1
  20. data/lib/vedeu/coercers/editor_line.rb +1 -1
  21. data/lib/vedeu/coercers/lines.rb +1 -1
  22. data/lib/vedeu/colours/backgrounds.rb +2 -0
  23. data/lib/vedeu/colours/foregrounds.rb +2 -0
  24. data/lib/vedeu/cursors/move.rb +1 -1
  25. data/lib/vedeu/cursors/refresh.rb +1 -2
  26. data/lib/vedeu/dsl/border.rb +1 -4
  27. data/lib/vedeu/dsl/geometry.rb +2 -6
  28. data/lib/vedeu/dsl/use.rb +1 -2
  29. data/lib/vedeu/dsl/view.rb +5 -7
  30. data/lib/vedeu/editor/cropper.rb +1 -1
  31. data/lib/vedeu/editor/editor.rb +1 -1
  32. data/lib/vedeu/events/event.rb +3 -4
  33. data/lib/vedeu/events/trigger.rb +1 -2
  34. data/lib/vedeu/geometries/area/area.rb +1 -1
  35. data/lib/vedeu/groups/clear.rb +3 -8
  36. data/lib/vedeu/groups/dsl.rb +2 -2
  37. data/lib/vedeu/groups/refresh.rb +2 -3
  38. data/lib/vedeu/input/capture.rb +1 -1
  39. data/lib/vedeu/input/dsl.rb +1 -2
  40. data/lib/vedeu/input/mapper.rb +2 -2
  41. data/lib/vedeu/interfaces/clear.rb +3 -14
  42. data/lib/vedeu/interfaces/dsl.rb +10 -15
  43. data/lib/vedeu/interfaces/repository.rb +3 -3
  44. data/lib/vedeu/menus/dsl.rb +1 -2
  45. data/lib/vedeu/models/focus.rb +4 -5
  46. data/lib/vedeu/models/toggleable.rb +8 -7
  47. data/lib/vedeu/output/compressor_cache.rb +15 -4
  48. data/lib/vedeu/output/refresh.rb +3 -3
  49. data/lib/vedeu/output/viewport.rb +4 -4
  50. data/lib/vedeu/plugins/plugin.rb +1 -1
  51. data/lib/vedeu/plugins/plugins.rb +2 -2
  52. data/lib/vedeu/repositories/collection.rb +2 -2
  53. data/lib/vedeu/repositories/repository.rb +6 -6
  54. data/lib/vedeu/repositories/store.rb +1 -1
  55. data/lib/vedeu/sentence.rb +2 -2
  56. data/lib/vedeu/version.rb +1 -1
  57. data/lib/vedeu/views/chars.rb +1 -1
  58. data/test/lib/vedeu/application/controller_test.rb +6 -0
  59. data/test/lib/vedeu/coercers/colour_test.rb +3 -1
  60. data/test/lib/vedeu/coercers/editor_line_test.rb +2 -0
  61. data/test/lib/vedeu/coercers/lines_test.rb +4 -0
  62. data/test/lib/vedeu/dsl/border_test.rb +13 -0
  63. data/test/lib/vedeu/dsl/geometry_test.rb +15 -0
  64. data/test/lib/vedeu/interfaces/repository_test.rb +1 -1
  65. data/test/lib/vedeu/models/toggleable_test.rb +6 -0
  66. data/test/lib/vedeu/output/refresh_test.rb +6 -6
  67. data/test/lib/vedeu/repositories/model_test.rb +6 -0
  68. data/test/lib/vedeu/repositories/registerable_test.rb +6 -0
  69. data/test/lib/vedeu/views/value_test.rb +6 -0
  70. data/test/support/examples/hello_world.rb +1 -1
  71. data/test/support/examples/view_templates_app/view_templates_app.rb +1 -1
  72. data/vedeu.gemspec +1 -1
  73. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7873b236437abf97edd687af67588fd80c87b3e9
4
- data.tar.gz: 4c2646bd4fb5366960fb0fef677d96aa929db230
3
+ metadata.gz: 805fd2db1418da4e71a147f7e0c3abffe83cbca0
4
+ data.tar.gz: 5ae3a8f1f58bbce6b6581063d766f8b67cb87925
5
5
  SHA512:
6
- metadata.gz: 1538cf094b528f976340e281c7cab189cf42e5190a662dff3d2b0ce61aa8990f26b05c7059c4ea29a19fa7ef830d362008a448d78160d9fb3e4dce44ef46527f
7
- data.tar.gz: 74dabd2d4fbd0aef2512601a521a105644d227d482be6a31ca3f0a6ef270e8ba6749f518141b54f35470c2c96313a36ba89b8395bb36ac1893e0cbed8a7b09e0
6
+ metadata.gz: 8b85555d260e7e07638b1239abb46f97c99929539f8bac9efebe7b4239c72d47bc3941012826595806bf5b195e6a6421a5cd85b20affdc89f443ba68608c69c0
7
+ data.tar.gz: c8906b96488c8158013fd89a5f5faa4a7f77c8978a199e994f059de9735b341e35d19647c810af8a98a861c745146c46dbcc101543444c96948c17e401a0b326
@@ -1,2 +1,5 @@
1
1
  ### Vedeu.clear_by_group
2
- @todo Add more documentation.
2
+ Clears the group of interfaces belonging to the given name.
3
+
4
+ Vedeu.trigger(:_clear_group_, name)
5
+ Vedeu.clear_by_group(name)
@@ -1,2 +1,5 @@
1
1
  ### Vedeu.clear_by_name
2
- @todo Add more documentation.
2
+ Clear the interface with the given name.
3
+
4
+ Vedeu.trigger(:_clear_view_, name)
5
+ Vedeu.clear_by_name(name)
@@ -1,2 +1,5 @@
1
1
  ### Vedeu.clear_content_by_name
2
- @todo Add more documentation.
2
+ Clear the content of the interface with the given name.
3
+
4
+ Vedeu.trigger(:_clear_view_content_, name)
5
+ Vedeu.clear_content_by_name(name)
@@ -1,2 +1,6 @@
1
1
  ### Vedeu.documents
2
- @todo Add more documentation.
2
+ Repository method. Access registered documents.
3
+
4
+ Vedeu.documents # [Vedeu::Editor::Repository]
5
+
6
+ Vedeu.documents.all # [Array<Vedeu::Editor::Border>]
@@ -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 is not
9
- given.
10
- - When the vertical is given (and not :none) and the height is not
11
- given.
12
-
13
- @todo Add more documentation.
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
@@ -23,7 +23,7 @@ class AlignmentApp
23
23
  title 'Top Left'
24
24
  end
25
25
  geometry do
26
- align(:top, :left, 20, 4)
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(:top, :centre, 20, 4)
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(:top, :right, 20, 4)
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(:middle, :left, 20, 4)
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(:middle, :centre, 20, 4)
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(:middle, :right, 20, 4)
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(:bottom, :left, 20, 4)
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(:bottom, :centre, 20, 4)
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(:bottom, :right, 20, 4)
98
+ align vertical: :bottom, horizontal: :right, width: 20, height: 4
99
99
  end
100
100
  end
101
101
 
@@ -25,7 +25,7 @@ class ColoursApp
25
25
  title 'Interface Colours'
26
26
  end
27
27
  geometry do
28
- align(:top, :left, 50, 20)
28
+ align vertical: :top, horizontal: :left, width: 50, height: 20
29
29
  end
30
30
  end
31
31
 
@@ -23,7 +23,7 @@ class EditorApp
23
23
  end
24
24
  editable!
25
25
  geometry do
26
- align(:top, :left, 40, 8)
26
+ align vertical: :top, horizontal: :left, width: 40, height: 8
27
27
  end
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ class HelloWorldsApp
31
31
  background '#000000'
32
32
  foreground '#00ff00'
33
33
  geometry do
34
- align(:middle, :centre, 24, 5)
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(:middle, :centre, (24 + 2), (5 + 2))
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
@@ -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 [void]
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'
@@ -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
- # @param name [String|Symbol] The name of the interface or view
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
- # @param name [String|Symbol] The name of the interface/view
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
@@ -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
- # @param name [String|Symbol]
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
- # @param name [String|Symbol] The name of the interface/view to
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]
@@ -30,7 +30,7 @@ module Vedeu
30
30
  protected
31
31
 
32
32
  # @!attribute [r] cell
33
- # @return [void]
33
+ # @return [Vedeu::Cells]
34
34
  attr_reader :cell
35
35
 
36
36
  # @!attribute [r] options
@@ -11,7 +11,7 @@ module Vedeu
11
11
  #
12
12
  class Chars < Vedeu::Coercers::Coercer
13
13
 
14
- # @return [void]
14
+ # @return [Vedeu::Views::Chars]
15
15
  def coerce
16
16
  end
17
17
 
@@ -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
@@ -12,7 +12,7 @@ module Vedeu
12
12
  class Colour < Vedeu::Coercers::Coercer
13
13
 
14
14
  # @macro raise_fatal
15
- # @return [void]
15
+ # @return [Vedeu::Colours::Colour]
16
16
  def coerce
17
17
  if coerced?
18
18
  value
@@ -11,7 +11,7 @@ module Vedeu
11
11
  #
12
12
  class EditorLine < Vedeu::Coercers::Coercer
13
13
 
14
- # @return [void]
14
+ # @return [Vedeu::Editor::Line]
15
15
  def coerce
16
16
  if coerced?
17
17
  value
@@ -12,7 +12,7 @@ module Vedeu
12
12
  class Lines < Vedeu::Coercers::Coercer
13
13
 
14
14
  # @macro raise_fatal
15
- # @return [void]
15
+ # @return [Vedeu::Views::Lines]
16
16
  def coerce
17
17
  if coerced?
18
18
  value
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Store background colour escape sequences by HTML/CSS code.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Backgrounds < Vedeu::Colours::Repository
10
12
 
11
13
  # {include:file:docs/dsl/by_method/background_colours.md}
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  # Store foreground colour escape sequences by HTML/CSS code.
8
8
  #
9
+ # @api private
10
+ #
9
11
  class Foregrounds < Vedeu::Colours::Repository
10
12
 
11
13
  # {include:file:docs/dsl/by_method/foreground_colours.md}
@@ -22,7 +22,7 @@ module Vedeu
22
22
  new(name, direction, offset).move
23
23
  end
24
24
 
25
- # @param name [String|Symbol]
25
+ # @macro param_name
26
26
  # @param direction [Symbol]
27
27
  # @param offset [Fixnum]
28
28
  # @return [Vedeu::Cursors::Move]
@@ -39,8 +39,7 @@ module Vedeu
39
39
 
40
40
  # Returns a new instance of Vedeu::Cursors::Refresh.
41
41
  #
42
- # @param name [String|Symbol] The name of the interface/view
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
@@ -32,10 +32,7 @@ module Vedeu
32
32
  # end
33
33
  # end
34
34
  #
35
- # @param name [String|Symbol] The name of the interface; this
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
@@ -14,8 +14,7 @@ module Vedeu
14
14
  module SingletonMethods
15
15
 
16
16
  # {include:file:docs/dsl/by_method/geometry.md}
17
- # @param name [String|Symbol] The name of the interface or
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
- # @param name [String|Symbol] The name of the interface; this
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
@@ -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
- # @param name [String|Symbol] The name of the model with the
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.