vedeu 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl/by_method/geometry.md +25 -1
  3. data/docs/dsl/by_method/geometry/align.md +13 -1
  4. data/docs/events/by_name/refresh_border.md +6 -2
  5. data/docs/events/by_name/refresh_view.md +3 -0
  6. data/docs/events/by_name/refresh_view_content.md +3 -0
  7. data/integrations/expected/dsl_app_021.out +1 -1
  8. data/integrations/expected/dsl_app_022.out +1 -1
  9. data/integrations/test_runner.sh +2 -0
  10. data/lib/vedeu/application/application_view.rb +1 -2
  11. data/lib/vedeu/borders/dsl.rb +1 -2
  12. data/lib/vedeu/borders/refresh.rb +2 -4
  13. data/lib/vedeu/buffers/empty.rb +10 -8
  14. data/lib/vedeu/buffers/refresh.rb +4 -8
  15. data/lib/vedeu/buffers/view.rb +6 -6
  16. data/lib/vedeu/coercers/alignment.rb +1 -2
  17. data/lib/vedeu/coercers/colour_attributes.rb +1 -0
  18. data/lib/vedeu/coercers/horizontal_alignment.rb +1 -1
  19. data/lib/vedeu/coercers/vertical_alignment.rb +1 -1
  20. data/lib/vedeu/colours/translator.rb +1 -3
  21. data/lib/vedeu/common.rb +12 -4
  22. data/lib/vedeu/configuration/api.rb +3 -5
  23. data/lib/vedeu/configuration/configuration.rb +0 -2
  24. data/lib/vedeu/cursors/coordinate.rb +1 -2
  25. data/lib/vedeu/dsl/border.rb +2 -4
  26. data/lib/vedeu/dsl/geometry.rb +4 -31
  27. data/lib/vedeu/dsl/helpers/wordwrap.rb +1 -1
  28. data/lib/vedeu/dsl/view.rb +4 -3
  29. data/lib/vedeu/error.rb +17 -0
  30. data/lib/vedeu/geometries/dsl/dsl.rb +2 -19
  31. data/lib/vedeu/groups/refresh.rb +1 -2
  32. data/lib/vedeu/input/dsl.rb +2 -6
  33. data/lib/vedeu/input/mapper.rb +1 -2
  34. data/lib/vedeu/input/read.rb +1 -0
  35. data/lib/vedeu/interfaces/dsl.rb +1 -0
  36. data/lib/vedeu/menus/dsl.rb +1 -2
  37. data/lib/vedeu/models/page.rb +1 -0
  38. data/lib/vedeu/output/output.rb +35 -44
  39. data/lib/vedeu/renderers/html.rb +1 -10
  40. data/lib/vedeu/renderers/options.rb +16 -21
  41. data/lib/vedeu/renderers/terminal.rb +4 -0
  42. data/lib/vedeu/repositories/defaults.rb +1 -2
  43. data/lib/vedeu/repositories/repository.rb +2 -3
  44. data/lib/vedeu/runtime/router.rb +3 -6
  45. data/lib/vedeu/support/point.rb +11 -0
  46. data/lib/vedeu/templating/template.rb +1 -2
  47. data/lib/vedeu/version.rb +1 -1
  48. data/lib/vedeu/views/chars.rb +1 -2
  49. data/lib/vedeu/views/lines.rb +1 -2
  50. data/lib/vedeu/views/streams.rb +1 -2
  51. data/lib/vedeu/views/view.rb +1 -2
  52. data/test/lib/vedeu/buffers/empty_test.rb +2 -2
  53. data/test/lib/vedeu/common_test.rb +22 -0
  54. data/test/lib/vedeu/output/output_test.rb +2 -2
  55. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49ac999b75c8f827532fdfd56a33cdc5df094082
4
- data.tar.gz: 0ce9c396da5d723b9859dd350e6549789646b9e9
3
+ metadata.gz: e9555539ac0be2991f1d6a1c9ea27c3579654085
4
+ data.tar.gz: a6c9a5aa1f8ab952bd5eda7026f4c9793f82f02b
5
5
  SHA512:
6
- metadata.gz: 32b568646e20740ceedb3993f87e9fd45ea8da54eb07103ea85811e67859d981168279075b45c48104aabbce542143651b2603518b0c2e7e3f1e1c8d6244f8ae
7
- data.tar.gz: 5d5325bf31f0f0cbdbf99726413de072aef1f2b3bf9dd6ba52fb65dc40e6e2d4744bfcfd939edace218c61ac1ed568775af8e3ed8411d44c4da0006e6224a151
6
+ metadata.gz: b14e6a7c9930b1fda6fc16b6a3c5a642cba1910352cdd0ad2962231230c8b50c19210f31790421c1398ee69c18be7475331f3089db6cd157f7e85fc50bfebf02
7
+ data.tar.gz: c7eb1dfa89fb435196236c0a9623aa2fb3155d73b5c98a9bc0492d8677e6f2ed940b5e4642b350c167dd5fdbcb62c40b49134c70bcc3b7e77c565be06d09acd2
@@ -1 +1,25 @@
1
- @todo Add more documentation.
1
+ Specify the geometry of an interface or view with a simple DSL.
2
+
3
+ # Standalone (preferred):
4
+ Vedeu.geometry :my_interface do
5
+ # ... see {Vedeu::Geometries::DSL}
6
+ end
7
+
8
+ Geometry can also be specified when configuring new interfaces or
9
+ views.
10
+
11
+ # As part of an interface:
12
+ Vedeu.interface :my_interface do
13
+ geometry do
14
+ # ... see {Vedeu::Geometries::DSL}
15
+ end
16
+ end
17
+
18
+ # As part of a view:
19
+ Vedeu.render do
20
+ view :my_interface do
21
+ geometry do
22
+ # ... see {Vedeu::Geometries::DSL}
23
+ end
24
+ end
25
+ end
@@ -1 +1,13 @@
1
- @todo Add more documentation.
1
+ Align the interface/view horizontally or vertically within the
2
+ terminal.
3
+
4
+ An error will be raised if:
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.
@@ -1,5 +1,9 @@
1
1
  ### `:_refresh_border_`
2
- This event refreshes the border of the named view, unless the view
3
- does not have a border, or the border is not enabled.
2
+ This event refreshes the border of the named view.
3
+
4
+ - If a name is not given, then the currently focussed view will be
5
+ refreshed as defined by `Vedeu.focus`.
6
+ - If the view does not have a border or the border is not enabled,
7
+ this event is silently ignored.
4
8
 
5
9
  Vedeu.trigger(:_refresh_border_, name)
@@ -2,3 +2,6 @@
2
2
  Will cause the named view to refresh.
3
3
 
4
4
  Vedeu.trigger(:_refresh_view_, name)
5
+
6
+ This event will only actually trigger if Vedeu is ready. Vedeu will
7
+ check this via `Vedeu.ready?`.
@@ -2,3 +2,6 @@
2
2
  Will cause only the content of the named view to refresh.
3
3
 
4
4
  Vedeu.trigger(:_refresh_view_content_, name)
5
+
6
+ This event will only actually trigger if Vedeu is ready. Vedeu will
7
+ check this via `Vedeu.ready?`.
@@ -1 +1 @@
1
- (0l(B(0k(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B 05 :thgieH 001 :htdiW (0q(B(0m(B(0j(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 +(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                04(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 +(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                03(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                02(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                01(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 +(0x(B(0x(B                                                                                                 -(0x(B(0x(B                                                                                                 -(0x(B(0x(B----+---09----+---08--------07--------06--------05--------04--------03--------02--------01----+--2
1
+ (0l(B(0q(B Width: 100 Height: 50 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(B2--+----10--------20--------30--------40--------50--------60--------70--------80---+----90---+----(0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B+                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B10                                                                                                (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B20                                                                                                (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B30                                                                                                (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B+                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B40                                                                                                (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B+                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0x(B-                                                                                                 (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -1 +1 @@
1
- (0l(B(0k(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B 05 :thgieH 001 :htdiW (0q(B(0m(B(0j(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       +(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                      03(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                      02(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                      01(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       -(0x(B(0x(B                                                                                       +(0x(B(0x(B                                                                    09 :htdiw yrtemoeg -(0x(B(0x(B                                                                   04 :thgieh yrtemoeg -(0x(B(0x(B----+---08--------07--------06--------05--------04--------03--------02--------01----+--2
1
+ (0l(B(0q(B Width: 100 Height: 50 (0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0k(B(0x(B2--+----10--------20--------30--------40--------50--------60--------70--------80---+----(0x(B(0x(B- geometry height: 40                                                                   (0x(B(0x(B- geometry width: 90                                                                    (0x(B(0x(B+                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B10                                                                                      (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B20                                                                                      (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B30                                                                                      (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B+                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0x(B-                                                                                       (0x(B(0m(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0q(B(0j(B
@@ -30,3 +30,5 @@ cd "$(dirname "$0")"
30
30
  ./dsl_app_014.rb
31
31
  ./dsl_app_015.rb
32
32
  ./dsl_app_016.rb
33
+ ./dsl_app_021.rb
34
+ ./dsl_app_022.rb
@@ -30,8 +30,7 @@ module Vedeu
30
30
  end
31
31
  end
32
32
 
33
- # @raise [Vedeu::Error::NotImplemented] Subclasses of this class
34
- # must implement this method.
33
+ # @macro raise_not_implemented
35
34
  def render
36
35
  fail Vedeu::Error::NotImplemented,
37
36
  'The subclass of Vedeu::ApplicationView must implement the #render' \
@@ -18,8 +18,7 @@ module Vedeu
18
18
  # to which this border belongs.
19
19
  # @param block [Proc]
20
20
  # @macro raise_requires_block
21
- # @raise [Vedeu::Error::MissingRequired] When the name is not
22
- # given.
21
+ # @macro raise_missing_required
23
22
  # @return [Vedeu::Borders::Border]
24
23
  def self.border(name, &block)
25
24
  fail Vedeu::Error::MissingRequired unless name
@@ -51,9 +51,7 @@ module Vedeu
51
51
  def_delegators :interface,
52
52
  :visible?
53
53
 
54
- # @example
55
- # Vedeu.trigger(:_refresh_border_, name)
56
- #
54
+ # {include:file:docs/events/by_name/refresh_border.md}
57
55
  # @param (see #initialize)
58
56
  # @return (see #by_name)
59
57
  def self.by_name(name = Vedeu.focus)
@@ -223,7 +221,7 @@ module Vedeu
223
221
 
224
222
  # :nocov:
225
223
 
226
- # See {file:docs/borders.md#label-3A_refresh_border_}
224
+ # {include:file:docs/events/by_name/refresh_border.md}
227
225
  Vedeu.bind(:_refresh_border_) do |name|
228
226
  Vedeu::Borders::Refresh.by_name(name) if Vedeu.ready?
229
227
  end
@@ -12,18 +12,10 @@ module Vedeu
12
12
 
13
13
  include Vedeu::Repositories::Defaults
14
14
 
15
- # @!attribute [r] height
16
- # @return [Fixnum]
17
- attr_reader :height
18
-
19
15
  # @!attribute [r] name
20
16
  # @return [NilClass|String|Symbol]
21
17
  attr_reader :name
22
18
 
23
- # @!attribute [r] width
24
- # @return [Fixnum]
25
- attr_reader :width
26
-
27
19
  # @!attribute [r] x
28
20
  # @return [Fixnum]
29
21
  attr_reader :x
@@ -37,6 +29,16 @@ module Vedeu
37
29
  @buffer ||= empty
38
30
  end
39
31
 
32
+ # @return [Fixnum]
33
+ def height
34
+ @height + 1
35
+ end
36
+
37
+ # @return [Fixnum]
38
+ def width
39
+ @width + 1
40
+ end
41
+
40
42
  private
41
43
 
42
44
  # Returns the default options/attributes for this class.
@@ -10,9 +10,7 @@ module Vedeu
10
10
 
11
11
  include Vedeu::Common
12
12
 
13
- # @example
14
- # Vedeu.trigger(:_refresh_view_, name)
15
- #
13
+ # {include:file:docs/events/by_name/refresh_view.md}
16
14
  # @param (see #initialize)
17
15
  # @return (see #by_name)
18
16
  def self.by_name(name = Vedeu.focus)
@@ -21,9 +19,7 @@ module Vedeu
21
19
  new(name).by_name
22
20
  end
23
21
 
24
- # @example
25
- # Vedeu.trigger(:_refresh_view_content_, name)
26
- #
22
+ # {include:file:docs/events/by_name/refresh_view_content.md}
27
23
  # @param (see #initialize)
28
24
  # @return (see #by_name)
29
25
  def self.refresh_content_by_name(name = Vedeu.focus)
@@ -87,12 +83,12 @@ module Vedeu
87
83
 
88
84
  # :nocov:
89
85
 
90
- # See {file:docs/events/refresh.md}
86
+ # See {file:docs/events/by_name/refresh_view.md}
91
87
  Vedeu.bind(:_refresh_view_) do |name|
92
88
  Vedeu::Buffers::Refresh.by_name(name) if Vedeu.ready?
93
89
  end
94
90
 
95
- # See {file:docs/events/refresh.md}
91
+ # See {file:docs/events/by_name/refresh_view_content.md}
96
92
  Vedeu.bind(:_refresh_view_content_) do |name|
97
93
  Vedeu::Buffers::Refresh.refresh_content_by_name(name) if Vedeu.ready?
98
94
  end
@@ -119,13 +119,13 @@ module Vedeu
119
119
  Vedeu::Point.valid?(value: y, min: by, max: byn)
120
120
  end
121
121
 
122
+ # Write the value into the respective cell as defined by the
123
+ # position attribute.
124
+ #
125
+ # @param value [void]
126
+ # @return [NilClass|void]
122
127
  def write(value)
123
- if valid?(value)
124
- row = by - value.position.y
125
- column = bx - value.position.x
126
-
127
- current[row][column] = value
128
- end
128
+ current[value.position.y][value.position.x] = value if valid?(value)
129
129
  end
130
130
 
131
131
  end # View
@@ -127,8 +127,7 @@ module Vedeu
127
127
  valid_type? && values.include?(value)
128
128
  end
129
129
 
130
- # @raise [Vedeu::Error::InvalidSyntax] When the value is missing or
131
- # invalid.
130
+ # @macro raise_invalid_syntax
132
131
  # @return [Boolean]
133
132
  def validate
134
133
  return coerce if valid_horizontal? || valid_vertical?
@@ -25,6 +25,7 @@ module Vedeu
25
25
  @value = value
26
26
  end
27
27
 
28
+ # @macro raise_invalid_syntax
28
29
  # @return [Hash]
29
30
  def coerce
30
31
  fail Vedeu::Error::InvalidSyntax unless hash?(value)
@@ -10,7 +10,7 @@ module Vedeu
10
10
  #
11
11
  class HorizontalAlignment < Vedeu::Coercers::Alignment
12
12
 
13
- # @raise (see Vedeu::Coercers::Alignment#validate)
13
+ # @macro raise_invalid_syntax
14
14
  # @return (see Vedeu::Coercers::Alignment#validate)
15
15
  def validate
16
16
  return coerce if valid_horizontal?
@@ -10,7 +10,7 @@ module Vedeu
10
10
  #
11
11
  class VerticalAlignment < Vedeu::Coercers::Alignment
12
12
 
13
- # @raise (see Vedeu::Coercers::Alignment#validate)
13
+ # @macro raise_invalid_syntax
14
14
  # @return (see Vedeu::Coercers::Alignment#validate)
15
15
  def validate
16
16
  return coerce if valid_vertical?
@@ -215,9 +215,7 @@ module Vedeu
215
215
  (css_to_rgb[2] / 51) * 1
216
216
  end
217
217
 
218
- # @raise [Vedeu::Error::NotImplemented] Subclasses of this class
219
- # must implement this method.
220
- # @return [Vedeu::Error::NotImplemented]
218
+ # @macro raise_not_implemented
221
219
  def not_implemented
222
220
  fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'
223
221
  end
@@ -44,6 +44,14 @@ module Vedeu
44
44
  value.is_a?(TrueClass) || value.is_a?(FalseClass)
45
45
  end
46
46
 
47
+ # Returns a boolean indicating whether the value is an escape
48
+ # sequence object (e.g. {Vedeu::Cells::Escape}.)
49
+ #
50
+ # @return [Boolean]
51
+ def escape?(value)
52
+ value.is_a?(Vedeu::Cells::Escape) || value.is_a?(Vedeu::Cells::Cursor)
53
+ end
54
+
47
55
  # Returns a boolean indicating whether the value should be
48
56
  # considered false.
49
57
  #
@@ -90,11 +98,11 @@ module Vedeu
90
98
  # check.
91
99
  # @return [Boolean]
92
100
  def present?(variable)
93
- return true if numeric?(variable)
94
- return true unless variable.nil? ||
95
- (variable.respond_to?(:empty?) && variable.empty?)
101
+ return true if numeric?(variable)
102
+ return false if variable.nil?
103
+ return false if variable.respond_to?(:empty?) && variable.empty?
96
104
 
97
- false
105
+ true
98
106
  end
99
107
 
100
108
  # Converts a class name to a lowercase snake case string.
@@ -259,8 +259,7 @@ module Vedeu
259
259
  # allow it to be detected, or use 256 here.
260
260
  #
261
261
  # @param value [Fixnum]
262
- # @raise [Vedeu::Error::InvalidSyntax] When the value parameter
263
- # is not one of +8+, +16+, +256+ or +16777216+.
262
+ # @macro raise_invalid_syntax
264
263
  # @return [Boolean]
265
264
  def colour_mode(value = nil)
266
265
  unless valid_colour_mode?(value)
@@ -514,8 +513,7 @@ module Vedeu
514
513
  # end
515
514
  #
516
515
  # @param mode [Symbol] Either ':cooked', ':fake' or ':raw'.
517
- # @raise [Vedeu::Error::InvalidSyntax] When the mode is not
518
- # ':cooked', ':fake' or ':raw'.
516
+ # @macro raise_invalid_syntax
519
517
  # @return [Symbol]
520
518
  # @see Vedeu::Config::API#cooked!
521
519
  # @see Vedeu::Config::API#fake!
@@ -612,7 +610,7 @@ module Vedeu
612
610
 
613
611
  private
614
612
 
615
- # @raise [Vedeu::Error::InvalidSyntax]
613
+ # @macro raise_invalid_syntax
616
614
  def invalid_mode!
617
615
  fail Vedeu::Error::InvalidSyntax,
618
616
  'Terminal mode can be set to either :cooked, :fake or :raw'
@@ -47,8 +47,6 @@ module Vedeu
47
47
  # @option opts stdout [File|IO]
48
48
  # @option opts stderr [File|IO]
49
49
  # @param block [Proc]
50
- # @raise [Vedeu::Error::InvalidSyntax]
51
- # When the required block is not given.
52
50
  # @return [Hash<Symbol => void>]
53
51
  def configure(opts = {}, &block)
54
52
  instance.configure(opts, &block)
@@ -120,8 +120,7 @@ module Vedeu
120
120
  # Ascertain the correct methods to use for determining the
121
121
  # coordinates.
122
122
  #
123
- # @raise [Vedeu::Error::InvalidSyntax] When the coordinate type
124
- # is not given.
123
+ # @macro raise_invalid_syntax
125
124
  # @return [Fixnum]
126
125
  def coordinate_type
127
126
  @_type ||= case type
@@ -28,8 +28,7 @@ module Vedeu
28
28
  # view to which this border belongs.
29
29
  # @param block [Proc]
30
30
  # @macro raise_requires_block
31
- # @raise [Vedeu::Error::MissingRequired] When a name is not
32
- # given.
31
+ # @macro raise_missing_required
33
32
  # @return [Vedeu::Borders::Border]
34
33
  # @see Vedeu::Borders::DSL
35
34
  def border(name, &block)
@@ -72,8 +71,7 @@ module Vedeu
72
71
  # {Vedeu::DSL::Border::ClassMethods.border}.
73
72
  # @param block [Proc]
74
73
  # @macro raise_requires_block
75
- # @raise [Vedeu::Error::MissingRequired] When a name is not
76
- # given.
74
+ # @macro raise_missing_required
77
75
  # @return [Vedeu::Borders::Border]
78
76
  # @see Vedeu::Borders::DSL
79
77
  def border(name = nil, &block)
@@ -16,20 +16,12 @@ module Vedeu
16
16
  #
17
17
  module ClassMethods
18
18
 
19
- # Specify the geometry of an interface or view with a simple
20
- # DSL.
21
- #
22
- # # Standalone (preferred):
23
- # Vedeu.geometry :my_interface do
24
- # # ... see {Vedeu::Geometries::DSL}
25
- # end
26
- #
19
+ # {include:file:docs/dsl/by_method/geometry.md}
27
20
  # @param name [String|Symbol] The name of the interface or
28
21
  # view to which this geometry belongs.
29
22
  # @param block [Proc]
30
23
  # @macro raise_requires_block
31
- # @raise [Vedeu::Error::MissingRequired] When a name is not
32
- # given.
24
+ # @macro raise_missing_required
33
25
  # @return [Vedeu::Geometries::Geometry]
34
26
  # @see Vedeu::Geometries::DSL
35
27
  def geometry(name = nil, &block)
@@ -58,33 +50,14 @@ module Vedeu
58
50
  #
59
51
  module InstanceMethods
60
52
 
61
- # Specify the geometry of an interface or view with a simple
62
- # DSL.
63
- #
64
- # # As part of an interface:
65
- # Vedeu.interface :my_interface do
66
- # geometry do
67
- # # ... see {Vedeu::Geometries::DSL}
68
- # end
69
- # end
70
- #
71
- # # As part of a view:
72
- # Vedeu.render do
73
- # view :my_interface do
74
- # geometry do
75
- # # ... see {Vedeu::Geometries::DSL}
76
- # end
77
- # end
78
- # end
79
- #
53
+ # {include:file:docs/dsl/by_method/geometry.md}
80
54
  # @param name [String|Symbol] The name of the interface; this
81
55
  # is already provided when we define the interface or view,
82
56
  # setting it here is just mirroring functionality of
83
57
  # {Vedeu::DSL::Geometry::ClassMethods#geometry}.
84
58
  # @param block [Proc]
85
59
  # @macro raise_requires_block
86
- # @raise [Vedeu::Error::MissingRequired] When a name is not
87
- # given.
60
+ # @macro raise_missing_required
88
61
  # @return [Vedeu::Geometries::Geometry]
89
62
  # @see Vedeu::Geometries::DSL
90
63
  def geometry(name = nil, &block)
@@ -181,7 +181,7 @@ module Vedeu
181
181
 
182
182
  # Returns the width to prune or wrap to.
183
183
  #
184
- # @raise [Vedeu::Error::MissingRequired]
184
+ # @macro raise_missing_required
185
185
  # @return [Fixnum]
186
186
  def width
187
187
  return options[:width] if present?(options[:width])