vedeu 0.4.17 → 0.4.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl.md +54 -0
  3. data/docs/views.md +25 -25
  4. data/examples/cursor_app.rb +1 -1
  5. data/examples/material_colours_app.rb +1 -1
  6. data/lib/vedeu/all.rb +1 -0
  7. data/lib/vedeu/bindings.rb +2 -15
  8. data/lib/vedeu/buffers/buffer.rb +30 -7
  9. data/lib/vedeu/buffers/display_buffer.rb +1 -1
  10. data/lib/vedeu/configuration/configuration.rb +1 -1
  11. data/lib/vedeu/cursor/refresh_cursor.rb +4 -0
  12. data/lib/vedeu/dsl/components/border.rb +6 -1
  13. data/lib/vedeu/geometry/all.rb +0 -1
  14. data/lib/vedeu/geometry/area.rb +0 -20
  15. data/lib/vedeu/geometry/coordinate.rb +0 -50
  16. data/lib/vedeu/geometry/geometry.rb +1 -5
  17. data/lib/vedeu/geometry/position.rb +9 -0
  18. data/lib/vedeu/geometry/position_index.rb +19 -14
  19. data/lib/vedeu/geometry/position_validator.rb +3 -0
  20. data/lib/vedeu/models/all.rb +0 -3
  21. data/lib/vedeu/models/interface.rb +2 -4
  22. data/lib/vedeu/null/all.rb +5 -0
  23. data/lib/vedeu/null/border.rb +79 -0
  24. data/lib/vedeu/null/buffer.rb +44 -0
  25. data/lib/vedeu/null/generic.rb +52 -0
  26. data/lib/vedeu/null/geometry.rb +70 -0
  27. data/lib/vedeu/null/interface.rb +23 -0
  28. data/lib/vedeu/output/all.rb +0 -1
  29. data/lib/vedeu/output/border.rb +9 -9
  30. data/lib/vedeu/output/clear.rb +2 -1
  31. data/lib/vedeu/output/output.rb +1 -1
  32. data/lib/vedeu/output/refresh.rb +1 -1
  33. data/lib/vedeu/output/renderers/all.rb +7 -7
  34. data/lib/vedeu/output/renderers/escape_sequence.rb +47 -0
  35. data/lib/vedeu/output/renderers/{file_renderer.rb → file.rb} +11 -6
  36. data/lib/vedeu/output/renderers/{html_renderer.rb → html.rb} +4 -4
  37. data/lib/vedeu/output/renderers/{json_renderer.rb → json.rb} +4 -4
  38. data/lib/vedeu/output/renderers/{null_renderer.rb → null.rb} +2 -2
  39. data/lib/vedeu/output/renderers/{terminal_renderer.rb → terminal.rb} +4 -4
  40. data/lib/vedeu/output/renderers/{text_renderer.rb → text.rb} +4 -4
  41. data/lib/vedeu/output/text.rb +2 -2
  42. data/lib/vedeu/output/virtual_terminal.rb +2 -2
  43. data/lib/vedeu/repositories/all.rb +2 -0
  44. data/lib/vedeu/repositories/repositories/borders.rb +4 -2
  45. data/lib/vedeu/repositories/repositories/buffers.rb +11 -9
  46. data/lib/vedeu/repositories/repositories/cursors.rb +2 -0
  47. data/lib/vedeu/repositories/repositories/events_repository.rb +2 -0
  48. data/lib/vedeu/repositories/repositories/geometries.rb +4 -2
  49. data/lib/vedeu/repositories/repositories/groups.rb +2 -0
  50. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +4 -2
  51. data/lib/vedeu/repositories/repositories/keymaps.rb +2 -0
  52. data/lib/vedeu/repositories/repositories/menus.rb +2 -0
  53. data/test/lib/vedeu/cursor/cursor_test.rb +1 -1
  54. data/test/lib/vedeu/cursor/move_test.rb +21 -33
  55. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +16 -1
  56. data/test/lib/vedeu/distributed/test_application_test.rb +1 -1
  57. data/test/lib/vedeu/dsl/components/border_test.rb +1 -1
  58. data/test/lib/vedeu/dsl/components/geometry_test.rb +5 -5
  59. data/test/lib/vedeu/dsl/components/menu_test.rb +1 -1
  60. data/test/lib/vedeu/dsl/composition_test.rb +1 -1
  61. data/test/lib/vedeu/dsl/group_test.rb +1 -1
  62. data/test/lib/vedeu/dsl/interface_test.rb +1 -1
  63. data/test/lib/vedeu/dsl/stream_test.rb +1 -1
  64. data/test/lib/vedeu/events/event_test.rb +8 -8
  65. data/test/lib/vedeu/events/trigger_test.rb +1 -1
  66. data/test/lib/vedeu/geometry/area_test.rb +4 -36
  67. data/test/lib/vedeu/geometry/canvas_test.rb +2 -2
  68. data/test/lib/vedeu/geometry/coordinate_test.rb +0 -56
  69. data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
  70. data/test/lib/vedeu/geometry/geometry_test.rb +1 -1
  71. data/test/lib/vedeu/geometry/grid_test.rb +1 -1
  72. data/test/lib/vedeu/geometry/position_index_test.rb +21 -23
  73. data/test/lib/vedeu/geometry/position_validator_test.rb +121 -3
  74. data/test/lib/vedeu/input/input_test.rb +1 -1
  75. data/test/lib/vedeu/input/key_test.rb +1 -1
  76. data/test/lib/vedeu/input/keymap_test.rb +1 -1
  77. data/test/lib/vedeu/models/interface_test.rb +14 -0
  78. data/test/lib/vedeu/null/border_test.rb +76 -0
  79. data/test/lib/vedeu/null/generic_test.rb +69 -0
  80. data/test/lib/vedeu/null/geometry_test.rb +63 -0
  81. data/test/lib/vedeu/null/interface_test.rb +13 -0
  82. data/test/lib/vedeu/output/clear_test.rb +1 -1
  83. data/test/lib/vedeu/output/compressor_test.rb +1 -1
  84. data/test/lib/vedeu/output/html_char_test.rb +1 -1
  85. data/test/lib/vedeu/output/output_test.rb +1 -1
  86. data/test/lib/vedeu/output/refresh_test.rb +17 -5
  87. data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +4 -4
  88. data/test/lib/vedeu/output/renderers/{file_renderer_test.rb → file_test.rb} +4 -4
  89. data/test/lib/vedeu/output/renderers/{html_renderer_test.rb → html_test.rb} +4 -4
  90. data/test/lib/vedeu/output/renderers/{json_renderer_test.rb → json_test.rb} +4 -4
  91. data/test/lib/vedeu/output/renderers/{null_renderer_test.rb → null_test.rb} +3 -3
  92. data/test/lib/vedeu/output/renderers/{terminal_renderer_test.rb → terminal_test.rb} +4 -4
  93. data/test/lib/vedeu/output/renderers/{text_renderer_test.rb → text_test.rb} +4 -4
  94. data/test/lib/vedeu/output/style_test.rb +1 -1
  95. data/test/lib/vedeu/output/translator_test.rb +1 -1
  96. data/test/lib/vedeu/output/viewport_test.rb +1 -1
  97. data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
  98. data/test/lib/vedeu/repositories/collection_test.rb +2 -2
  99. data/test/lib/vedeu/repositories/collections/chars_test.rb +1 -1
  100. data/test/lib/vedeu/repositories/collections/events_test.rb +1 -1
  101. data/test/lib/vedeu/repositories/collections/interfaces_test.rb +1 -1
  102. data/test/lib/vedeu/repositories/collections/keys_test.rb +1 -1
  103. data/test/lib/vedeu/repositories/collections/lines_test.rb +1 -1
  104. data/test/lib/vedeu/repositories/collections/streams_test.rb +1 -1
  105. data/test/lib/vedeu/repositories/repositories/borders_test.rb +1 -1
  106. data/test/lib/vedeu/repositories/repositories/buffers_test.rb +11 -23
  107. data/test/lib/vedeu/repositories/repositories/colours_test.rb +1 -1
  108. data/test/lib/vedeu/repositories/repositories/geometries_test.rb +1 -1
  109. data/test/lib/vedeu/repositories/repository_test.rb +1 -1
  110. data/test/lib/vedeu/storage/associative_store_test.rb +1 -1
  111. data/test/lib/vedeu/storage/conveyor_store_test.rb +1 -1
  112. data/test/lib/vedeu/storage/fifo_store_test.rb +1 -1
  113. data/test/lib/vedeu/support/template_test.rb +1 -1
  114. data/test/lib/vedeu/support/trace_test.rb +1 -1
  115. data/test/lib/vedeu/support/visibility_test.rb +2 -2
  116. data/test/test_helper.rb +1 -1
  117. data/vedeu.gemspec +1 -1
  118. metadata +36 -33
  119. data/lib/vedeu/geometry/null_geometry.rb +0 -70
  120. data/lib/vedeu/models/null.rb +0 -48
  121. data/lib/vedeu/models/null_interface.rb +0 -20
  122. data/lib/vedeu/output/null_border.rb +0 -75
  123. data/lib/vedeu/output/renderers/escape_sequence_renderer.rb +0 -43
  124. data/test/lib/vedeu/geometry/null_geometry_test.rb +0 -59
  125. data/test/lib/vedeu/models/null_interface_test.rb +0 -9
  126. data/test/lib/vedeu/models/null_test.rb +0 -66
  127. data/test/lib/vedeu/output/null_border_test.rb +0 -72
@@ -0,0 +1,44 @@
1
+ module Vedeu
2
+
3
+ module Null
4
+
5
+ # Provides a non-existent Vedeu::Buffer that acts like the real thing, but
6
+ # does nothing.
7
+ #
8
+ class Buffer
9
+
10
+ # @!attribute [r] name
11
+ # @return [String]
12
+ attr_reader :name
13
+
14
+ # @param name [String]
15
+ # @return [Vedeu::Null::Buffer]
16
+ def initialize(name)
17
+ @name = name
18
+ end
19
+
20
+ # @return [NilClass]
21
+ def clear
22
+ nil
23
+ end
24
+
25
+ # @return [NilClass]
26
+ def hide
27
+ nil
28
+ end
29
+
30
+ # @return [NilClass]
31
+ def render
32
+ nil
33
+ end
34
+
35
+ # @return [NilClass]
36
+ def show
37
+ nil
38
+ end
39
+
40
+ end # Buffer
41
+
42
+ end # Null
43
+
44
+ end # Vedeu
@@ -0,0 +1,52 @@
1
+ module Vedeu
2
+
3
+ module Null
4
+
5
+ # Provides a non-existent model to swallow messages.
6
+ #
7
+ class Generic
8
+
9
+ # @return [Vedeu::Null::Generic]
10
+ def initialize; end
11
+
12
+ # @return [NilClass]
13
+ def add(*)
14
+ nil
15
+ end
16
+
17
+ # @return [NilClass]
18
+ def colour
19
+ nil
20
+ end
21
+
22
+ # @return [NilClass]
23
+ def parent
24
+ nil
25
+ end
26
+
27
+ # @return [Vedeu::Null::Generic]
28
+ def store
29
+ self
30
+ end
31
+
32
+ # @return [NilClass]
33
+ def style
34
+ nil
35
+ end
36
+
37
+ # @return [FalseClass]
38
+ def visible?
39
+ false
40
+ end
41
+ alias_method :visible, :visible?
42
+
43
+ # @return [FalseClass]
44
+ def visible=(*)
45
+ false
46
+ end
47
+
48
+ end # Generic
49
+
50
+ end # Null
51
+
52
+ end # Vedeu
@@ -0,0 +1,70 @@
1
+ module Vedeu
2
+
3
+ module Null
4
+
5
+ # Provides a non-existent model to swallow messages.
6
+ #
7
+ class Geometry
8
+
9
+ extend Forwardable
10
+
11
+ def_delegators :area,
12
+ :north,
13
+ :east,
14
+ :south,
15
+ :west,
16
+ :top,
17
+ :right,
18
+ :bottom,
19
+ :left,
20
+ :y,
21
+ :xn,
22
+ :yn,
23
+ :x,
24
+ :height,
25
+ :width
26
+
27
+ # @!attribute [r] name
28
+ # @return [String|NilClass]
29
+ attr_reader :name
30
+
31
+ # Returns a new instance of Vedeu::Null::Geometry.
32
+ #
33
+ # @param name [String|NilClass]
34
+ # @return [Vedeu::Null::Geometry]
35
+ def initialize(name = nil)
36
+ @name = name
37
+ end
38
+
39
+ # @return [FalseClass]
40
+ def centred
41
+ false
42
+ end
43
+
44
+ # @return [Vedeu::Null::Geometry]
45
+ def store
46
+ self
47
+ end
48
+
49
+ private
50
+
51
+ # @return [Vedeu::Area]
52
+ def area
53
+ @area ||= Vedeu::Area.from_dimensions(y_yn: y_yn, x_xn: x_xn)
54
+ end
55
+
56
+ # @return [Array<Fixnum>]
57
+ def x_xn
58
+ @x_xn ||= Vedeu::Dimension.pair(default: Vedeu::Terminal.width)
59
+ end
60
+
61
+ # @return [Array<Fixnum>]
62
+ def y_yn
63
+ @y_yn ||= Vedeu::Dimension.pair(default: Vedeu::Terminal.height)
64
+ end
65
+
66
+ end # Geometry
67
+
68
+ end # Null
69
+
70
+ end # Vedeu
@@ -0,0 +1,23 @@
1
+ module Vedeu
2
+
3
+ module Null
4
+
5
+ # Provides a non-existent model to swallow messages.
6
+ #
7
+ class Interface
8
+
9
+ # @!attribute [r] attributes
10
+ # @return [Hash]
11
+ attr_reader :attributes
12
+
13
+ # @param attributes [Hash]
14
+ # @return [Vedeu::Null::Interface]
15
+ def initialize(attributes = {})
16
+ @attributes = attributes
17
+ end
18
+
19
+ end # Interface
20
+
21
+ end # Null
22
+
23
+ end # Vedeu
@@ -3,7 +3,6 @@ require_relative 'translator'
3
3
  require_relative 'background'
4
4
  require_relative 'foreground'
5
5
  require_relative 'border'
6
- require_relative 'null_border'
7
6
  require_relative 'colour'
8
7
  require_relative 'compressor'
9
8
  require_relative 'clear'
@@ -174,7 +174,7 @@ module Vedeu
174
174
 
175
175
  # @return [String]
176
176
  def to_s
177
- Vedeu::TextRenderer.render(render)
177
+ Vedeu::Renderers::Text.render(render)
178
178
  end
179
179
 
180
180
  # Renders the bottom border for the interface.
@@ -364,14 +364,14 @@ module Vedeu
364
364
  # @return [Vedeu::Position]
365
365
  def position(name, iy = 0, ix = 0)
366
366
  case name
367
- when :top_horizontal then Vedeu::Position[y, (bx + ix)]
368
- when :bottom_horizontal then Vedeu::Position[yn, (bx + ix)]
369
- when :left_vertical then Vedeu::Position[(by + iy), x]
370
- when :right_vertical then Vedeu::Position[(by + iy), xn]
371
- when :bottom_left then geometry.bottom_left
372
- when :bottom_right then geometry.bottom_right
373
- when :top_left then geometry.top_left
374
- when :top_right then geometry.top_right
367
+ when :top_horizontal then [y, (bx + ix)]
368
+ when :bottom_horizontal then [yn, (bx + ix)]
369
+ when :left_vertical then [(by + iy), x]
370
+ when :right_vertical then [(by + iy), xn]
371
+ when :bottom_left then [yn, x]
372
+ when :bottom_right then [yn, xn]
373
+ when :top_left then [y, x]
374
+ when :top_right then [y, xn]
375
375
  end
376
376
  end
377
377
 
@@ -105,7 +105,8 @@ module Vedeu
105
105
  # the terminal, or the colours of the interface.
106
106
  def clear_colour
107
107
  if use_terminal_colours?
108
- Vedeu::Colour.new(background: :default, foreground: :default)
108
+ @colour ||= Vedeu::Colour.new(background: :default,
109
+ foreground: :default)
109
110
 
110
111
  else
111
112
  colour
@@ -30,7 +30,7 @@ module Vedeu
30
30
  if Vedeu::Configuration.drb?
31
31
  Vedeu.trigger(:_drb_store_output_, content)
32
32
 
33
- Vedeu::HTMLRenderer.to_file(Vedeu::VirtualBuffer.retrieve)
33
+ Vedeu::Renderers::HTML.to_file(Vedeu::VirtualBuffer.retrieve)
34
34
  end
35
35
 
36
36
  Vedeu.renderers.render(content)
@@ -39,7 +39,7 @@ module Vedeu
39
39
  def by_name(name)
40
40
  Vedeu.log(type: :info, message: "Refreshing interface: '#{name}'")
41
41
 
42
- Vedeu.buffers.render(name)
42
+ Vedeu.buffers.by_name(name).render
43
43
  end
44
44
 
45
45
  end # Refresh
@@ -1,10 +1,10 @@
1
- require_relative 'escape_sequence_renderer'
2
- require_relative 'file_renderer'
3
- require_relative 'html_renderer'
4
- require_relative 'json_renderer'
5
- require_relative 'null_renderer'
6
- require_relative 'terminal_renderer'
7
- require_relative 'text_renderer'
1
+ require_relative 'escape_sequence'
2
+ require_relative 'file'
3
+ require_relative 'html'
4
+ require_relative 'json'
5
+ require_relative 'null'
6
+ require_relative 'terminal'
7
+ require_relative 'text'
8
8
 
9
9
  module Vedeu
10
10
 
@@ -0,0 +1,47 @@
1
+ module Vedeu
2
+
3
+ module Renderers
4
+
5
+ # A renderer which returns the escape sequence for each character.
6
+ #
7
+ class EscapeSequence
8
+
9
+ # @param output [Array<Array<Vedeu::Char>>]
10
+ # @return [String]
11
+ def self.render(output)
12
+ new(output).render
13
+ end
14
+
15
+ # @param output [Array<Array<Vedeu::Char>>]
16
+ def initialize(output)
17
+ @output = output
18
+ end
19
+
20
+ # @return [String]
21
+ def render
22
+ Vedeu.log(type: :debug,
23
+ message: "#{self.class.name}:\n#{parsed}")
24
+
25
+ parsed
26
+ end
27
+
28
+ private
29
+
30
+ # @!attribute [r] output
31
+ # @return [Array<Array<Vedeu::Char>>]
32
+ attr_reader :output
33
+
34
+ # Escapes the escape sequences.
35
+ #
36
+ # @return [String]
37
+ def parsed
38
+ @parsed ||= Array(output).flatten.map do |char|
39
+ Esc.escape(char.to_s) + "\n"
40
+ end.join
41
+ end
42
+
43
+ end # EscapeSequence
44
+
45
+ end # Renderers
46
+
47
+ end # Vedeu
@@ -4,7 +4,7 @@ module Vedeu
4
4
  # and content suitable for a terminal, and writes them to a file in the /tmp
5
5
  # directory.
6
6
  #
7
- class FileRenderer
7
+ class Renderers::File
8
8
 
9
9
  # @param output [Array<Array<Vedeu::Char>>]
10
10
  # @param options [Hash]
@@ -13,11 +13,11 @@ module Vedeu
13
13
  new(output, options).render
14
14
  end
15
15
 
16
- # Returns a new instance of Vedeu::FileRenderer.
16
+ # Returns a new instance of Vedeu::Renderers::File.
17
17
  #
18
18
  # @param output [Array<Array<Vedeu::Char>>]
19
19
  # @param options [Hash]
20
- # @return [Vedeu::FileRenderer]
20
+ # @return [Vedeu::Renderers::File]
21
21
  def initialize(output, options = {})
22
22
  @output = output
23
23
  @options = options
@@ -25,7 +25,7 @@ module Vedeu
25
25
 
26
26
  # @return [String]
27
27
  def render
28
- File.open("/tmp/#{filename}", 'w') { |f| f.write(parsed) }
28
+ File.open(path, 'w') { |f| f.write(parsed) }
29
29
 
30
30
  parsed
31
31
  end
@@ -36,6 +36,11 @@ module Vedeu
36
36
  # @return [Array<Array<Vedeu::Char>>]
37
37
  attr_reader :output
38
38
 
39
+ # @return [String]
40
+ def path
41
+ "/tmp/#{filename}"
42
+ end
43
+
39
44
  # @return [String]
40
45
  def filename
41
46
  if timestamp?
@@ -54,7 +59,7 @@ module Vedeu
54
59
 
55
60
  # @return [Float]
56
61
  def timestamp
57
- Time.now.to_f
62
+ @timestamp ||= Time.now.to_f
58
63
  end
59
64
 
60
65
  # @return [Boolean]
@@ -76,6 +81,6 @@ module Vedeu
76
81
  }
77
82
  end
78
83
 
79
- end # FileRenderer
84
+ end # Renderers::File
80
85
 
81
86
  end # Vedeu
@@ -2,7 +2,7 @@ module Vedeu
2
2
 
3
3
  # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as a HTML table.
4
4
  #
5
- class HTMLRenderer
5
+ class Renderers::HTML
6
6
 
7
7
  # @param output [Array<Array<Vedeu::Char>>]
8
8
  # @return [String]
@@ -17,10 +17,10 @@ module Vedeu
17
17
  new(output).to_file(path)
18
18
  end
19
19
 
20
- # Returns a new instance of Vedeu::HTMLRenderer.
20
+ # Returns a new instance of Vedeu::Renderers::HTML.
21
21
  #
22
22
  # @param output [Array<Array<Vedeu::Char>>]
23
- # @return [Vedeu::HTMLRenderer]
23
+ # @return [Vedeu::Renderers::HTML]
24
24
  def initialize(output)
25
25
  @output = output
26
26
  end
@@ -80,6 +80,6 @@ module Vedeu
80
80
  @timestamp ||= Time.now.to_i
81
81
  end
82
82
 
83
- end # HTMLRenderer
83
+ end # Renderers::HTML
84
84
 
85
85
  end # Vedeu
@@ -2,7 +2,7 @@ module Vedeu
2
2
 
3
3
  # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as JSON.
4
4
  #
5
- class JSONRenderer
5
+ class Renderers::JSON
6
6
 
7
7
  # @param output [Array<Array<Vedeu::Char>>]
8
8
  # @return [String]
@@ -17,10 +17,10 @@ module Vedeu
17
17
  # new(output).to_file(path)
18
18
  # end
19
19
 
20
- # Returns a new instance of Vedeu::JSONRenderer.
20
+ # Returns a new instance of Vedeu::Renderers::JSON.
21
21
  #
22
22
  # @param output [Array<Array<Vedeu::Char>>]
23
- # @return [Vedeu::JSONRenderer]
23
+ # @return [Vedeu::Renderers::JSON]
24
24
  def initialize(output)
25
25
  @output = output
26
26
  end
@@ -47,6 +47,6 @@ module Vedeu
47
47
  # @return [Array<Array<Vedeu::Char>>]
48
48
  attr_reader :output
49
49
 
50
- end # JSONRenderer
50
+ end # Renderers::JSON
51
51
 
52
52
  end # Vedeu
@@ -2,13 +2,13 @@ module Vedeu
2
2
 
3
3
  # A renderer which returns nothing.
4
4
  #
5
- class NullRenderer
5
+ class Renderers::Null
6
6
 
7
7
  # @return [NilClass]
8
8
  def self.render(*)
9
9
  nil
10
10
  end
11
11
 
12
- end # NullRenderer
12
+ end # Renderers::Null
13
13
 
14
14
  end # Vedeu
@@ -3,7 +3,7 @@ module Vedeu
3
3
  # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
4
4
  # and content suitable for a terminal.
5
5
  #
6
- class TerminalRenderer
6
+ class Renderers::Terminal
7
7
 
8
8
  # @param output [Array<Array<Vedeu::Char>>]
9
9
  # @return [String]
@@ -11,10 +11,10 @@ module Vedeu
11
11
  new(*output).render
12
12
  end
13
13
 
14
- # Returns a new instance of Vedeu::TerminalRenderer.
14
+ # Returns a new instance of Vedeu::Renderers::Terminal.
15
15
  #
16
16
  # @param output [Array<Array<Vedeu::Char>>]
17
- # @return [Vedeu::TerminalRenderer]
17
+ # @return [Vedeu::Renderers::Terminal]
18
18
  def initialize(*output)
19
19
  @output = output
20
20
  end
@@ -35,6 +35,6 @@ module Vedeu
35
35
  Vedeu::Compressor.new(output).render
36
36
  end
37
37
 
38
- end # TerminalRenderer
38
+ end # Renderers::Terminal
39
39
 
40
40
  end # Vedeu
@@ -3,7 +3,7 @@ module Vedeu
3
3
  # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
4
4
  # and content.
5
5
  #
6
- class TextRenderer
6
+ class Renderers::Text
7
7
 
8
8
  # @param output [Array<Array<Vedeu::Char>>]
9
9
  # @return [String]
@@ -11,10 +11,10 @@ module Vedeu
11
11
  new(*output).render
12
12
  end
13
13
 
14
- # Returns a new instance of Vedeu::TextRenderer.
14
+ # Returns a new instance of Vedeu::Renderers::Text.
15
15
  #
16
16
  # @param output [Array<Array<Vedeu::Char>>]
17
- # @return [Vedeu::TextRenderer]
17
+ # @return [Vedeu::Renderers::Text]
18
18
  def initialize(*output)
19
19
  @output = output
20
20
  end
@@ -35,6 +35,6 @@ module Vedeu
35
35
  Vedeu::Compressor.new(output).render
36
36
  end
37
37
 
38
- end # TextRenderer
38
+ end # Renderers::Text
39
39
 
40
40
  end # Vedeu
@@ -133,9 +133,9 @@ module Vedeu
133
133
 
134
134
  # Returns the model option if set.
135
135
  #
136
- # @return [Vedeu::Interface|Vedeu::Line|Vedeu::Null|Vedeu::Stream]
136
+ # @return [Vedeu::Interface|Vedeu::Line|Vedeu::Null::Generic|Vedeu::Stream]
137
137
  def model
138
- @model ||= options[:model] || Vedeu::Null.new
138
+ @model ||= options[:model] || Vedeu::Null::Generic.new
139
139
  end
140
140
 
141
141
  # The character to use for padding the string.
@@ -20,9 +20,9 @@ module Vedeu
20
20
  #
21
21
  # @param height [Fixnum]
22
22
  # @param width [Fixnum]
23
- # @param renderer [Object|HTMLRenderer] An object responding to .render.
23
+ # @param renderer [Object|Renderers::HTML] An object responding to .render.
24
24
  # @return [Vedeu::VirtualTerminal]
25
- def initialize(height, width, renderer = Vedeu::HTMLRenderer)
25
+ def initialize(height, width, renderer = Vedeu::Renderers::HTML)
26
26
  @height = height
27
27
  @width = width
28
28
  @renderer = renderer
@@ -18,6 +18,8 @@ module Vedeu
18
18
  storage.add(klass)
19
19
  end
20
20
 
21
+ # Remove all stored models from the repository.
22
+ #
21
23
  # @return [TrueClass]
22
24
  def reset!
23
25
  storage.map(&:repository).map { |repository| repository.send(:reset) }
@@ -13,6 +13,8 @@ module Vedeu
13
13
  end
14
14
  alias_method :repository, :borders
15
15
 
16
+ # Remove all stored models from the repository.
17
+ #
16
18
  # @return [Vedeu::Borders]
17
19
  def reset!
18
20
  @borders = Vedeu::Borders.register_repository(Vedeu::Border)
@@ -21,13 +23,13 @@ module Vedeu
21
23
  end
22
24
 
23
25
  # @param name [String] The name of the stored border.
24
- # @return [Vedeu::Border|Vedeu::NullBorder]
26
+ # @return [Vedeu::Border|Vedeu::Null::Border]
25
27
  def by_name(name)
26
28
  if registered?(name)
27
29
  find(name)
28
30
 
29
31
  else
30
- Vedeu::NullBorder.new(name)
32
+ Vedeu::Null::Border.new(name)
31
33
 
32
34
  end
33
35
  end
@@ -12,6 +12,8 @@ module Vedeu
12
12
  end
13
13
  alias_method :repository, :buffers
14
14
 
15
+ # Remove all stored models from the repository.
16
+ #
15
17
  # @return [Vedeu::Buffers]
16
18
  def reset!
17
19
  @buffers = Vedeu::Buffers.register_repository(Vedeu::Buffer)
@@ -19,16 +21,16 @@ module Vedeu
19
21
 
20
22
  end
21
23
 
22
- # @param name [String] The name of buffer to clear.
23
- # @return [void]
24
- def clear(name)
25
- find!(name).clear
26
- end
24
+ # @param name [String] The name of the stored buffer.
25
+ # @return [Vedeu::Buffer|Vedeu::Null::Buffer]
26
+ def by_name(name)
27
+ if registered?(name)
28
+ find(name)
29
+
30
+ else
31
+ Vedeu::Null::Buffer.new(name)
27
32
 
28
- # @param name [String] The name of buffer to render.
29
- # @return [void]
30
- def render(name)
31
- find!(name).render
33
+ end
32
34
  end
33
35
 
34
36
  end # Buffers
@@ -17,6 +17,8 @@ module Vedeu
17
17
  cursors.by_name(Vedeu.focus) if Vedeu.focus
18
18
  end
19
19
 
20
+ # Remove all stored models from the repository.
21
+ #
20
22
  # @return [Vedeu::Cursors]
21
23
  def reset!
22
24
  @cursors = Vedeu::Cursors.register_repository(Vedeu::Cursor)
@@ -12,6 +12,8 @@ module Vedeu
12
12
  end
13
13
  alias_method :repository, :events
14
14
 
15
+ # Remove all stored models from the repository.
16
+ #
15
17
  # @return [Vedeu::EventsRepository]
16
18
  def reset!
17
19
  @events = Vedeu::EventsRepository.new(Vedeu::Events)
@@ -13,6 +13,8 @@ module Vedeu
13
13
  end
14
14
  alias_method :repository, :geometries
15
15
 
16
+ # Remove all stored models from the repository.
17
+ #
16
18
  # @return [Vedeu::Geometries]
17
19
  def reset!
18
20
  @geometries = Vedeu::Geometries.register_repository(Vedeu::Geometry)
@@ -21,13 +23,13 @@ module Vedeu
21
23
  end
22
24
 
23
25
  # @param name [String] The name of the stored geometry.
24
- # @return [Vedeu::Geometry|Vedeu::NullGeometry]
26
+ # @return [Vedeu::Geometry|Vedeu::Null::Geometry]
25
27
  def by_name(name)
26
28
  if registered?(name)
27
29
  find(name)
28
30
 
29
31
  else
30
- Vedeu::NullGeometry.new(name)
32
+ Vedeu::Null::Geometry.new(name)
31
33
 
32
34
  end
33
35
  end
@@ -12,6 +12,8 @@ module Vedeu
12
12
  end
13
13
  alias_method :repository, :groups
14
14
 
15
+ # Remove all stored models from the repository.
16
+ #
15
17
  # @return [Vedeu::Groups]
16
18
  def reset!
17
19
  @groups = Vedeu::Groups.register_repository(Vedeu::Group)