vedeu 0.4.32 → 0.4.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/bin/vedeu +3 -0
  3. data/docs/dsl.md +36 -2
  4. data/examples/borders_app.rb +5 -0
  5. data/examples/colours_app.rb +5 -0
  6. data/examples/configuration_app.rb +5 -0
  7. data/examples/drb_app.rb +4 -0
  8. data/examples/focus_app.rb +5 -0
  9. data/examples/geometry_app.rb +4 -0
  10. data/examples/hello_world.rb +5 -0
  11. data/examples/material_colours_app.rb +15 -8
  12. data/examples/panel_app.rb +5 -0
  13. data/examples/typed_commands/typed_commands_app.rb +4 -4
  14. data/examples/view_templates_app/view_templates_app.rb +4 -4
  15. data/lib/vedeu/application.rb +2 -0
  16. data/lib/vedeu/bindings.rb +1 -0
  17. data/lib/vedeu/buffers/buffer.rb +2 -0
  18. data/lib/vedeu/buffers/display_buffer.rb +1 -0
  19. data/lib/vedeu/configuration/api.rb +2 -0
  20. data/lib/vedeu/configuration/cli.rb +2 -0
  21. data/lib/vedeu/configuration/configuration.rb +1 -0
  22. data/lib/vedeu/cursor/cursor.rb +2 -0
  23. data/lib/vedeu/cursor/move.rb +2 -0
  24. data/lib/vedeu/cursor/refresh_cursor.rb +2 -0
  25. data/lib/vedeu/debug.rb +1 -0
  26. data/lib/vedeu/distributed/uri.rb +2 -0
  27. data/lib/vedeu/dsl/all.rb +1 -0
  28. data/lib/vedeu/dsl/border.rb +3 -0
  29. data/lib/vedeu/dsl/composition.rb +1 -0
  30. data/lib/vedeu/dsl/geometry.rb +1 -0
  31. data/lib/vedeu/dsl/group.rb +2 -0
  32. data/lib/vedeu/dsl/interface.rb +22 -1
  33. data/lib/vedeu/dsl/presentation.rb +0 -1
  34. data/lib/vedeu/dsl/text.rb +1 -0
  35. data/lib/vedeu/dsl/use.rb +3 -1
  36. data/lib/vedeu/events/event.rb +2 -0
  37. data/lib/vedeu/events/trigger.rb +2 -0
  38. data/lib/vedeu/geometry/area.rb +2 -0
  39. data/lib/vedeu/geometry/coordinate.rb +2 -0
  40. data/lib/vedeu/geometry/dimension.rb +2 -0
  41. data/lib/vedeu/geometry/geometry.rb +1 -0
  42. data/lib/vedeu/geometry/grid.rb +2 -0
  43. data/lib/vedeu/geometry/index_position.rb +2 -0
  44. data/lib/vedeu/geometry/position.rb +2 -0
  45. data/lib/vedeu/geometry/position_index.rb +2 -0
  46. data/lib/vedeu/geometry/position_validator.rb +2 -0
  47. data/lib/vedeu/input/input.rb +2 -0
  48. data/lib/vedeu/input/key.rb +2 -0
  49. data/lib/vedeu/input/keymap.rb +2 -0
  50. data/lib/vedeu/input/mapper.rb +2 -0
  51. data/lib/vedeu/main_loop.rb +1 -0
  52. data/lib/vedeu/models/cell.rb +2 -0
  53. data/lib/vedeu/models/char.rb +2 -0
  54. data/lib/vedeu/models/composition.rb +2 -0
  55. data/lib/vedeu/models/escape_char.rb +2 -0
  56. data/lib/vedeu/models/focus.rb +1 -0
  57. data/lib/vedeu/models/group.rb +2 -0
  58. data/lib/vedeu/models/interface.rb +2 -0
  59. data/lib/vedeu/models/line.rb +2 -0
  60. data/lib/vedeu/models/menu.rb +2 -0
  61. data/lib/vedeu/models/panel.rb +2 -0
  62. data/lib/vedeu/models/stream.rb +2 -0
  63. data/lib/vedeu/null/all.rb +2 -0
  64. data/lib/vedeu/null/border.rb +2 -0
  65. data/lib/vedeu/null/buffer.rb +2 -0
  66. data/lib/vedeu/null/generic.rb +2 -0
  67. data/lib/vedeu/null/geometry.rb +2 -0
  68. data/lib/vedeu/null/interface.rb +2 -0
  69. data/lib/vedeu/output/background.rb +2 -0
  70. data/lib/vedeu/output/border.rb +2 -0
  71. data/lib/vedeu/output/clear.rb +2 -0
  72. data/lib/vedeu/output/colour.rb +1 -0
  73. data/lib/vedeu/output/compressor.rb +2 -0
  74. data/lib/vedeu/output/esc.rb +1 -0
  75. data/lib/vedeu/output/foreground.rb +2 -0
  76. data/lib/vedeu/output/html_char.rb +2 -0
  77. data/lib/vedeu/output/output.rb +2 -0
  78. data/lib/vedeu/output/presentation.rb +1 -0
  79. data/lib/vedeu/output/refresh.rb +1 -0
  80. data/lib/vedeu/output/renderers/all.rb +3 -0
  81. data/lib/vedeu/output/renderers/escape_sequence.rb +2 -0
  82. data/lib/vedeu/output/renderers/file.rb +2 -0
  83. data/lib/vedeu/output/renderers/html.rb +2 -0
  84. data/lib/vedeu/output/renderers/json.rb +2 -0
  85. data/lib/vedeu/output/renderers/null.rb +2 -0
  86. data/lib/vedeu/output/renderers/terminal.rb +2 -0
  87. data/lib/vedeu/output/renderers/text.rb +2 -0
  88. data/lib/vedeu/output/style.rb +1 -0
  89. data/lib/vedeu/output/text.rb +2 -0
  90. data/lib/vedeu/output/translator.rb +2 -0
  91. data/lib/vedeu/output/viewport.rb +2 -0
  92. data/lib/vedeu/output/virtual_terminal.rb +2 -0
  93. data/lib/vedeu/output/wordwrap.rb +2 -0
  94. data/lib/vedeu/repositories/collection.rb +2 -0
  95. data/lib/vedeu/repositories/collections/all.rb +12 -0
  96. data/lib/vedeu/repositories/model.rb +2 -0
  97. data/lib/vedeu/repositories/registerable.rb +2 -0
  98. data/lib/vedeu/repositories/repositories/background_colours.rb +2 -0
  99. data/lib/vedeu/repositories/repositories/borders.rb +2 -0
  100. data/lib/vedeu/repositories/repositories/buffers.rb +2 -0
  101. data/lib/vedeu/repositories/repositories/colours.rb +2 -0
  102. data/lib/vedeu/repositories/repositories/cursors.rb +2 -0
  103. data/lib/vedeu/repositories/repositories/events_repository.rb +2 -0
  104. data/lib/vedeu/repositories/repositories/foreground_colours.rb +2 -0
  105. data/lib/vedeu/repositories/repositories/geometries.rb +2 -0
  106. data/lib/vedeu/repositories/repositories/groups.rb +2 -0
  107. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -0
  108. data/lib/vedeu/repositories/repositories/keymaps.rb +2 -0
  109. data/lib/vedeu/repositories/repositories/menus.rb +2 -0
  110. data/lib/vedeu/repositories/repository.rb +3 -3
  111. data/lib/vedeu/storage/associative_store.rb +2 -0
  112. data/lib/vedeu/storage/conveyor_store.rb +2 -0
  113. data/lib/vedeu/storage/fifo_store.rb +2 -0
  114. data/lib/vedeu/storage/store.rb +1 -0
  115. data/lib/vedeu/support/common.rb +1 -0
  116. data/lib/vedeu/support/log.rb +3 -0
  117. data/lib/vedeu/support/options.rb +2 -0
  118. data/lib/vedeu/support/template.rb +2 -0
  119. data/lib/vedeu/support/terminal.rb +1 -0
  120. data/lib/vedeu/support/timer.rb +2 -1
  121. data/lib/vedeu/support/visibility.rb +2 -0
  122. data/lib/vedeu/templating/directive.rb +3 -0
  123. data/lib/vedeu/templating/helpers.rb +2 -0
  124. data/lib/vedeu/templating/preprocessor.rb +4 -0
  125. data/lib/vedeu/traps.rb +1 -0
  126. data/lib/vedeu/version.rb +2 -1
  127. data/test/lib/vedeu/dsl/border_test.rb +19 -0
  128. data/test/lib/vedeu/dsl/geometry_test.rb +19 -0
  129. data/test/lib/vedeu/dsl/interface_test.rb +19 -0
  130. metadata +2 -2
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Sends the content to the renderers.
4
+ #
5
+ # @api private
4
6
  class Output
5
7
 
6
8
  # Writes content to the defined renderers.
@@ -3,6 +3,7 @@ module Vedeu
3
3
  # This module allows the sharing of presentation concerns between the models:
4
4
  # Interface, Line and Stream.
5
5
  #
6
+ # @api private
6
7
  module Presentation
7
8
 
8
9
  # @return [Vedeu::Background]
@@ -2,6 +2,7 @@ module Vedeu
2
2
 
3
3
  # Refreshes the terminal.
4
4
  #
5
+ # @api private
5
6
  module Refresh
6
7
 
7
8
  module_function
@@ -9,6 +9,8 @@ require_relative 'text'
9
9
  module Vedeu
10
10
 
11
11
  # Provides a single interface to all registered renderers.
12
+ #
13
+ # @api private
12
14
  module Renderers
13
15
 
14
16
  extend Enumerable
@@ -16,6 +18,7 @@ module Vedeu
16
18
 
17
19
  # Provides access to the list of renderers.
18
20
  #
21
+ # @api public
19
22
  # @return [Module]
20
23
  def renderers
21
24
  self
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Renderers
4
4
 
5
5
  # A renderer which returns the escape sequence for each character.
6
+ #
7
+ # @api private
6
8
  class EscapeSequence
7
9
 
8
10
  # @param output [Array<Array<Vedeu::Char>>]
@@ -5,6 +5,8 @@ module Vedeu
5
5
  # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
6
  # and content suitable for a terminal, and writes them to a file in the /tmp
7
7
  # directory.
8
+ #
9
+ # @api private
8
10
  class File
9
11
 
10
12
  # @param output [Array<Array<Vedeu::Char>>]
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Renderers
4
4
 
5
5
  # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as a HTML table.
6
+ #
7
+ # @api private
6
8
  class HTML
7
9
 
8
10
  # @param output [Array<Array<Vedeu::Char>>]
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Renderers
4
4
 
5
5
  # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as JSON.
6
+ #
7
+ # @api private
6
8
  class JSON
7
9
 
8
10
  # @param output [Array<Array<Vedeu::Char>>]
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Renderers
4
4
 
5
5
  # A renderer which returns nothing.
6
+ #
7
+ # @api private
6
8
  class Null
7
9
 
8
10
  # @return [NilClass]
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
6
  # and content suitable for a terminal.
7
+ #
8
+ # @api private
7
9
  class Terminal
8
10
 
9
11
  # @param output [Array<Array<Vedeu::Char>>]
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
6
  # and content.
7
+ #
8
+ # @api private
7
9
  class Text
8
10
 
9
11
  # @param output [Array<Array<Vedeu::Char>>]
@@ -9,6 +9,7 @@ module Vedeu
9
9
  # Styles are applied as encountered.
10
10
  #
11
11
  # @see Vedeu::Esc
12
+ # @api private
12
13
  class Style
13
14
 
14
15
  include Vedeu::Common
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Present a string (or object responding to `to_s`).
4
+ #
5
+ # @api private
4
6
  class Text
5
7
 
6
8
  # @see Vedeu::DSL::Text#text
@@ -19,6 +19,8 @@ module Vedeu
19
19
  # a 24-bit representation.
20
20
  #
21
21
  # @todo More documentation required (create a fancy chart!)
22
+ #
23
+ # @api private
22
24
  class Translator
23
25
 
24
26
  # @!attribute [r] colour
@@ -5,6 +5,8 @@ module Vedeu
5
5
  # When a buffer has more lines than the defined height, or more columns than
6
6
  # the defined width of the interface, the Viewport class provides 'scrolling'
7
7
  # via the cursor's position.
8
+ #
9
+ # @api private
8
10
  class Viewport
9
11
 
10
12
  extend Forwardable
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Represents a {Vedeu::Terminal} view as a grid of {Vedeu::Cell} objects.
4
+ #
5
+ # @api private
4
6
  class VirtualTerminal
5
7
 
6
8
  # @!attribute [rw] renderer
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Wrap or prune text.
4
+ #
5
+ # @api private
4
6
  class Wordwrap
5
7
 
6
8
  # @see {Vedeu::Wordwrap#initialize}
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Convert an Array into an object which has some meaning in the context it
4
4
  # is being used.
5
+ #
6
+ # @api private
5
7
  class Collection
6
8
 
7
9
  include Enumerable
@@ -3,31 +3,43 @@ require 'vedeu/repositories/collection'
3
3
  module Vedeu
4
4
 
5
5
  # A collection of {Vedeu::Char} instances.
6
+ #
7
+ # @api private
6
8
  class Chars < Vedeu::Collection
7
9
 
8
10
  end # Chars
9
11
 
10
12
  # A collection of {Vedeu::Event} instances.
13
+ #
14
+ # @api private
11
15
  class Events < Vedeu::Collection
12
16
 
13
17
  end # Events
14
18
 
15
19
  # A collection of {Vedeu::Interface} instances.
20
+ #
21
+ # @api private
16
22
  class Interfaces < Vedeu::Collection
17
23
 
18
24
  end # Interfaces
19
25
 
20
26
  # A collection of {Vedeu::Key} instances.
27
+ #
28
+ # @api private
21
29
  class Keys < Vedeu::Collection
22
30
 
23
31
  end # Keys
24
32
 
25
33
  # A collection of {Vedeu::Line} instances.
34
+ #
35
+ # @api private
26
36
  class Lines < Vedeu::Collection
27
37
 
28
38
  end # Lines
29
39
 
30
40
  # A collection of {Vedeu::Stream} instances.
41
+ #
42
+ # @api private
31
43
  class Streams < Vedeu::Collection
32
44
 
33
45
  end # Streams
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # When included into a class, provides the mechanism to store the class in a
4
4
  # repository for later retrieval.
5
+ #
6
+ # @api private
5
7
  module Model
6
8
 
7
9
  # @!attribute [rw] repository
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Repositories contain registerables, this module provides convenience methods
4
4
  # for them.
5
+ #
6
+ # @api private
5
7
  module Registerable
6
8
 
7
9
  # These class methods are mixed into the repository.
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Store background colour escape sequences by HTML/CSS code.
4
+ #
5
+ # @api public
4
6
  class BackgroundColours < Colours
5
7
 
6
8
  # @return [Vedeu::BackgroundColours]
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of interface/view borders independent of the interface
4
4
  # instance.
5
+ #
6
+ # @api public
5
7
  class Borders < Repository
6
8
 
7
9
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of view buffers.
4
+ #
5
+ # @api public
4
6
  class Buffers < Repository
5
7
 
6
8
  class << self
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of HTML/CSS colours and their respective escape
4
4
  # sequences.
5
+ #
6
+ # @api public
5
7
  class Colours
6
8
 
7
9
  # @!attribute [r] storage
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of each interface's cursor.
4
+ #
5
+ # @api public
4
6
  class Cursors < Repository
5
7
 
6
8
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of events.
4
+ #
5
+ # @api public
4
6
  class EventsRepository < Repository
5
7
 
6
8
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Store foreground colour escape sequences by HTML/CSS code.
4
+ #
5
+ # @api public
4
6
  class ForegroundColours < Colours
5
7
 
6
8
  # @return [Vedeu::ForegroundColours]
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of interface/view geometry independent of the interface
4
4
  # instance.
5
+ #
6
+ # @api public
5
7
  class Geometries < Repository
6
8
 
7
9
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of view groups.
4
+ #
5
+ # @api public
4
6
  class Groups < Repository
5
7
 
6
8
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of interfaces and views.
4
+ #
5
+ # @api public
4
6
  class InterfacesRepository < Repository
5
7
 
6
8
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of keymaps.
4
+ #
5
+ # @api public
4
6
  class Keymaps < Repository
5
7
 
6
8
  class << self
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Allows the storing of menus by name.
4
+ #
5
+ # @api public
4
6
  class Menus < Repository
5
7
 
6
8
  class << self
@@ -8,6 +8,8 @@ module Vedeu
8
8
  # { 'models' => [Model, Model, Model] }
9
9
  #
10
10
  # { 'models' => [Model] }
11
+ #
12
+ # @api private
11
13
  class Repository
12
14
 
13
15
  include Vedeu::Common
@@ -41,11 +43,9 @@ module Vedeu
41
43
 
42
44
  # @return [Array<void>] An array containing each stored model.
43
45
  def all
44
- return [] if empty?
45
46
  return storage.values if storage.is_a?(Hash)
46
- return storage.to_a if storage.is_a?(Set)
47
47
 
48
- storage
48
+ registered
49
49
  end
50
50
 
51
51
  # @param name [String] The name of the stored model.
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # Name/Value storage.
4
4
  #
5
5
  # name: [value]
6
+ #
7
+ # @api private
6
8
  class AssociativeStore
7
9
 
8
10
  include Vedeu::Store
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Conveyor belt like storage. The belt can move forward (`load_next`) or
4
4
  # backwards (`load_previous`), or a named entry can be retrieved.
5
+ #
6
+ # @api private
5
7
  class ConveyorStore
6
8
 
7
9
  include Vedeu::Store
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # First-in first-out storage.
4
4
  #
5
5
  # in -> [3] -> [2] -> [1] -> out
6
+ #
7
+ # @api private
6
8
  class FifoStore
7
9
 
8
10
  include Vedeu::Store
@@ -2,6 +2,7 @@ module Vedeu
2
2
 
3
3
  # Provides generic repository related behaviour.
4
4
  #
5
+ # @api private
5
6
  module Store
6
7
 
7
8
  include Enumerable
@@ -2,6 +2,7 @@ module Vedeu
2
2
 
3
3
  # A module for common methods used throughout Vedeu.
4
4
  #
5
+ # @api private
5
6
  module Common
6
7
 
7
8
  # Returns a boolean indicating whether a variable has a useful value.