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
@@ -6,7 +6,6 @@ module Vedeu
6
6
  # {Vedeu::DSL::Line} and {Vedeu::DSL::Stream} classes.
7
7
  #
8
8
  # @api public
9
- #
10
9
  module Presentation
11
10
 
12
11
  # Define the background colour for an interface, line, or a stream. When
@@ -4,6 +4,7 @@ module Vedeu
4
4
 
5
5
  # Provides helper methods for building views.
6
6
  #
7
+ # @api public
7
8
  module Text
8
9
 
9
10
  # Specify the content for a view. Provides the means to align a string
data/lib/vedeu/dsl/use.rb CHANGED
@@ -4,6 +4,7 @@ module Vedeu
4
4
 
5
5
  # Provides helper methods for building views.
6
6
  #
7
+ # @api public
7
8
  module Use
8
9
 
9
10
  # Duplicate a stored model.
@@ -40,7 +41,8 @@ module Vedeu
40
41
  #
41
42
  # This DSL method provides access to a stored model by name. You can
42
43
  # then request an attribute of that model for use within the current
43
- # model.
44
+ # model. The models which current support this are Border, Geometry and
45
+ # Interface.
44
46
  #
45
47
  # @example
46
48
  # # Here the character used for 'my_border' is used in
@@ -29,6 +29,8 @@ module Vedeu
29
29
  # # Not all events you define will have arguments; like methods.
30
30
  # :do_stuff
31
31
  # end
32
+ #
33
+ # @api public
32
34
  class Event
33
35
 
34
36
  include Vedeu::Model
@@ -7,6 +7,8 @@ module Vedeu
7
7
  #
8
8
  # @example
9
9
  # Vedeu.trigger(:my_event, :oxidize, 'nitrogen')
10
+ #
11
+ # @api public
10
12
  class Trigger
11
13
 
12
14
  # @param name [Symbol] The name of the event you wish to trigger. The event
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Define an area from dimensions or points.
4
+ #
5
+ # @api private
4
6
  class Area
5
7
 
6
8
  # @!attribute [r] y
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Crudely corrects out of range values.
4
+ #
5
+ # @api private
4
6
  class Coordinate
5
7
 
6
8
  extend Forwardable
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # A Dimension is either the height or width of an entity.
4
+ #
5
+ # @api private
4
6
  class Dimension
5
7
 
6
8
  # @param (see #initialize)
@@ -9,6 +9,7 @@ module Vedeu
9
9
  # Calculates and provides interface geometry determined by both the client's
10
10
  # requirements and the terminal's current viewing area.
11
11
  #
12
+ # @api private
12
13
  class Geometry
13
14
 
14
15
  extend Forwardable
@@ -19,6 +19,8 @@ module Vedeu
19
19
  # # Terminal is 38 characters wide, maximum value is
20
20
  # # therefore 36, meaning a row is 3 characters tall.
21
21
  # # (And height is therefore 9 characters tall.)
22
+ #
23
+ # @api public
22
24
  class Grid
23
25
 
24
26
  # @see #initialize
@@ -4,6 +4,8 @@ module Vedeu
4
4
  #
5
5
  # When the optional offset `oy` and `ox` params are given, the they are used
6
6
  # for the starting position.
7
+ #
8
+ # @api private
7
9
  class IndexPosition
8
10
 
9
11
  # @param (see #initialize)
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Change coordinates into an escape sequence to set the cursor position.
4
+ #
5
+ # @api private
4
6
  class Position
5
7
 
6
8
  # @!attribute [r] y
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Converts a position into an index for the terminal. An index is the position
4
4
  # minus 1.
5
+ #
6
+ # @api private
5
7
  class PositionIndex
6
8
 
7
9
  # Convenience constructor for Vedeu::Position.
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Validates that the provided coordinates are within the terminal and
4
4
  # interface's geometry (with or without a border).
5
+ #
6
+ # @api private
5
7
  class PositionValidator
6
8
 
7
9
  extend Forwardable
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Captures input from the user via {Vedeu::Terminal#input} and translates
4
4
  # special characters into symbols.
5
+ #
6
+ # @api private
5
7
  class Input
6
8
 
7
9
  # Instantiate Input and capture keypress(es).
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # A single keypress or combination of keypresses bound to a specific action.
4
+ #
5
+ # @api private
4
6
  class Key
5
7
 
6
8
  # @!attribute [r] input
@@ -3,6 +3,8 @@ require 'vedeu/dsl/keymap'
3
3
  module Vedeu
4
4
 
5
5
  # A container class for keys associated with a particular interface.
6
+ #
7
+ # @api private
6
8
  class Keymap
7
9
 
8
10
  include Vedeu::Model
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Maps keys to keymaps.
4
+ #
5
+ # @api private
4
6
  class Mapper
5
7
 
6
8
  # Takes a key as a keypress and sends it to registered keymaps. If found,
@@ -2,6 +2,7 @@ module Vedeu
2
2
 
3
3
  # Provides the main loop for a Vedeu application.
4
4
  #
5
+ # @api private
5
6
  class MainLoop
6
7
 
7
8
  trap('SIGTERM') { stop! }
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # A Cell represents a single square of the terminal.
4
+ #
5
+ # @api private
4
6
  class Cell
5
7
 
6
8
  # @!attribute [r] colour
@@ -10,6 +10,8 @@ module Vedeu
10
10
  #
11
11
  # Though a multi-character String can be passed as a value, only the first
12
12
  # character is returned in the escape sequence.
13
+ #
14
+ # @api private
13
15
  class Char
14
16
 
15
17
  include Vedeu::Presentation
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # A composition is a collection of interfaces.
4
+ #
5
+ # @api private
4
6
  class Composition
5
7
 
6
8
  include Vedeu::Model
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Represents an invisible escape character sequence.
4
+ #
5
+ # @api private
4
6
  class EscapeChar
5
7
 
6
8
  # @!attribute [r] value
@@ -4,6 +4,7 @@ module Vedeu
4
4
  # serving to store and manipulate the which interface is currently being
5
5
  # focussed.
6
6
  #
7
+ # @api private
7
8
  module Focus
8
9
 
9
10
  extend self
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Interfaces can be associated with one another by being members of the same
4
4
  # Group. A Group is a collection of interface names.
5
+ #
6
+ # @api private
5
7
  class Group
6
8
 
7
9
  include Vedeu::Model
@@ -5,6 +5,8 @@ module Vedeu
5
5
  # An Interface represents a portion of the terminal defined by
6
6
  # {Vedeu::Geometry}. It is a container for {Vedeu::Line} and {Vedeu::Stream}
7
7
  # objects.
8
+ #
9
+ # @api private
8
10
  class Interface
9
11
 
10
12
  extend Forwardable
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # A Line represents a single row of the terminal. It is a container for
4
4
  # {Vedeu::Stream} objects. A line's width is determined by the
5
5
  # {Vedeu::Interface} it belongs to.
6
+ #
7
+ # @api private
6
8
  class Line
7
9
 
8
10
  include Vedeu::Model
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Converts the collection passed into a list of menu items which can be
4
4
  # navigated using the instance methods or events provided.
5
+ #
6
+ # @api private
5
7
  class Menu
6
8
 
7
9
  include Vedeu::Model
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Abstract interface class without the baggage.
4
+ #
5
+ # @api private
4
6
  class Panel
5
7
 
6
8
  # @return [Vedeu::Panel]
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # A Stream can represent a character or collection of characters as part of a
4
4
  # {Vedeu::Line} which you wish to colour and style independently of the other
5
5
  # characters in that line.
6
+ #
7
+ # @api private
6
8
  class Stream
7
9
 
8
10
  include Vedeu::Model
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # A group of objects that serve to intercept messages destined for their
4
4
  # real counterpart. In most cases the call is muted or returns a generic
5
5
  # value that does not halt processing.
6
+ #
7
+ # @api private
6
8
  module Null
7
9
 
8
10
  end
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # Provides a non-existent Vedeu::Border that acts like the real thing, but
6
6
  # does nothing.
7
+ #
8
+ # @api private
7
9
  class Border
8
10
 
9
11
  # @!attribute [r] name
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  # Provides a non-existent Vedeu::Buffer that acts like the real thing, but
6
6
  # does nothing.
7
+ #
8
+ # @api private
7
9
  class Buffer
8
10
 
9
11
  # @!attribute [r] name
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Null
4
4
 
5
5
  # Provides a non-existent model to swallow messages.
6
+ #
7
+ # @api private
6
8
  class Generic
7
9
 
8
10
  # Returns an instance of the Vedeu::Null::Generic class.
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Null
4
4
 
5
5
  # Provides a non-existent model to swallow messages.
6
+ #
7
+ # @api private
6
8
  class Geometry
7
9
 
8
10
  extend Forwardable
@@ -3,6 +3,8 @@ module Vedeu
3
3
  module Null
4
4
 
5
5
  # Provides a non-existent model to swallow messages.
6
+ #
7
+ # @api private
6
8
  class Interface
7
9
 
8
10
  # @param name [String]
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # The class represents one half (the other, can be found at
4
4
  # {Vedeu::Foreground}) of a terminal colour escape sequence.
5
+ #
6
+ # @api private
5
7
  class Background < Vedeu::Translator
6
8
 
7
9
  private
@@ -7,6 +7,8 @@ module Vedeu
7
7
  #
8
8
  # @note Refer to UTF-8 U+2500 to U+257F for border characters. More details
9
9
  # can be found at: http://en.wikipedia.org/wiki/Box-drawing_character
10
+ #
11
+ # @api private
10
12
  class Border
11
13
 
12
14
  extend Forwardable
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
3
  # Clears the area defined by an interface.
4
+ #
5
+ # @api private
4
6
  class Clear
5
7
 
6
8
  extend Forwardable
@@ -30,6 +30,7 @@ module Vedeu
30
30
  # area needs more work in Vedeu.
31
31
  #
32
32
  # @todo Fix colours in all terminals. (GL: 2015-04-13)
33
+ # @api private
33
34
  class Colour
34
35
 
35
36
  # @!attribute [r] attributes
@@ -3,6 +3,8 @@ module Vedeu
3
3
  # During the conversion of a Vedeu::Char object into a string of escape
4
4
  # sequences, this class removes multiple occurences of the same escape
5
5
  # sequence, resulting in a smaller payload being sent to the renderer.
6
+ #
7
+ # @api private
6
8
  class Compressor
7
9
 
8
10
  # @param output [Array<Array<Vedeu::Char>>]
@@ -3,6 +3,7 @@ module Vedeu
3
3
  # Provides escape sequence strings for setting the cursor position and various
4
4
  # display related functions.
5
5
  #
6
+ # @api public
6
7
  module Esc
7
8
 
8
9
  extend self
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # The class represents one half (the other, can be found at
4
4
  # {Vedeu::Background}) of a terminal colour escape sequence.
5
+ #
6
+ # @api private
5
7
  class Foreground < Vedeu::Translator
6
8
 
7
9
  private
@@ -3,6 +3,8 @@ require 'vedeu/support/common'
3
3
  module Vedeu
4
4
 
5
5
  # Represents a {Vedeu::Char} as a HTML table cell.
6
+ #
7
+ # @api private
6
8
  class HTMLChar
7
9
 
8
10
  include Vedeu::Common