vedeu 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl.md +3 -3
  3. data/examples/borders_app.rb +2 -0
  4. data/examples/colours_app.rb +2 -0
  5. data/examples/configuration_app.rb +2 -0
  6. data/examples/drb_app.rb +2 -0
  7. data/examples/focus_app.rb +2 -0
  8. data/examples/hello_world.rb +2 -0
  9. data/examples/material_colours_app.rb +2 -0
  10. data/lib/vedeu.rb +2 -0
  11. data/lib/vedeu/all.rb +4 -13
  12. data/lib/vedeu/api.rb +7 -6
  13. data/lib/vedeu/borders/border.rb +1 -1
  14. data/lib/vedeu/borders/render_border.rb +18 -18
  15. data/lib/vedeu/buffers/buffer.rb +18 -28
  16. data/lib/vedeu/colours/colour.rb +1 -1
  17. data/lib/vedeu/colours/colour_translator.rb +1 -1
  18. data/lib/vedeu/cursor/cursor.rb +9 -6
  19. data/lib/vedeu/dsl/border.rb +1 -1
  20. data/lib/vedeu/dsl/composition.rb +5 -5
  21. data/lib/vedeu/dsl/geometry.rb +1 -1
  22. data/lib/vedeu/dsl/group.rb +1 -1
  23. data/lib/vedeu/dsl/interface.rb +69 -93
  24. data/lib/vedeu/dsl/keymap.rb +1 -1
  25. data/lib/vedeu/dsl/line.rb +11 -11
  26. data/lib/vedeu/dsl/shared.rb +81 -0
  27. data/lib/vedeu/dsl/stream.rb +3 -3
  28. data/lib/vedeu/dsl/view.rb +76 -64
  29. data/lib/vedeu/models/escape.rb +1 -1
  30. data/lib/vedeu/models/interface.rb +3 -57
  31. data/lib/vedeu/models/menu.rb +1 -1
  32. data/lib/vedeu/models/views/all.rb +22 -0
  33. data/lib/vedeu/models/views/char.rb +175 -0
  34. data/lib/vedeu/models/views/chars.rb +13 -0
  35. data/lib/vedeu/models/views/composition.rb +73 -0
  36. data/lib/vedeu/models/views/line.rb +111 -0
  37. data/lib/vedeu/models/views/lines.rb +13 -0
  38. data/lib/vedeu/models/views/stream.rb +122 -0
  39. data/lib/vedeu/models/views/streams.rb +13 -0
  40. data/lib/vedeu/models/views/view.rb +157 -0
  41. data/lib/vedeu/models/views/view_collection.rb +13 -0
  42. data/lib/vedeu/null/view.rb +67 -0
  43. data/lib/vedeu/output/clear/named_interface.rb +4 -4
  44. data/lib/vedeu/output/compressor.rb +6 -6
  45. data/lib/vedeu/output/html_char.rb +6 -6
  46. data/lib/vedeu/output/output.rb +3 -3
  47. data/lib/vedeu/output/presentation.rb +1 -1
  48. data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
  49. data/lib/vedeu/output/renderers/file.rb +1 -1
  50. data/lib/vedeu/output/renderers/html.rb +3 -3
  51. data/lib/vedeu/output/renderers/json.rb +4 -4
  52. data/lib/vedeu/output/renderers/null.rb +1 -1
  53. data/lib/vedeu/output/renderers/terminal.rb +5 -5
  54. data/lib/vedeu/output/renderers/text.rb +3 -3
  55. data/lib/vedeu/output/style.rb +1 -1
  56. data/lib/vedeu/output/text.rb +20 -15
  57. data/lib/vedeu/output/viewport.rb +16 -23
  58. data/lib/vedeu/output/virtual_buffer.rb +9 -8
  59. data/lib/vedeu/output/virtual_terminal.rb +11 -11
  60. data/lib/vedeu/output/wordwrap.rb +5 -5
  61. data/lib/vedeu/runtime/application.rb +1 -1
  62. data/lib/vedeu/runtime/main_loop.rb +1 -1
  63. data/lib/vedeu/templating/helpers.rb +11 -10
  64. data/lib/vedeu/templating/template.rb +1 -1
  65. data/lib/vedeu/templating/view_template.rb +6 -6
  66. data/lib/vedeu/version.rb +1 -2
  67. data/test/lib/vedeu/api_test.rb +30 -30
  68. data/test/lib/vedeu/buffers/buffer_test.rb +5 -139
  69. data/test/lib/vedeu/colours/colour_translator_test.rb +3 -3
  70. data/test/lib/vedeu/configuration/api_test.rb +3 -3
  71. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +1 -1
  72. data/test/lib/vedeu/dsl/composition_test.rb +7 -7
  73. data/test/lib/vedeu/dsl/group_test.rb +2 -2
  74. data/test/lib/vedeu/dsl/interface_test.rb +31 -21
  75. data/test/lib/vedeu/dsl/keymap_test.rb +4 -4
  76. data/test/lib/vedeu/dsl/line_test.rb +8 -8
  77. data/test/lib/vedeu/dsl/stream_test.rb +4 -4
  78. data/test/lib/vedeu/dsl/text_test.rb +11 -11
  79. data/test/lib/vedeu/dsl/view_test.rb +24 -29
  80. data/test/lib/vedeu/geometry/grid_test.rb +4 -4
  81. data/test/lib/vedeu/input/key_test.rb +1 -1
  82. data/test/lib/vedeu/internal_api_test.rb +18 -18
  83. data/test/lib/vedeu/models/focus_test.rb +54 -54
  84. data/test/lib/vedeu/models/interface_test.rb +11 -105
  85. data/test/lib/vedeu/models/menu_test.rb +1 -1
  86. data/test/lib/vedeu/models/views/char_test.rb +257 -0
  87. data/test/lib/vedeu/models/views/chars_test.rb +22 -0
  88. data/test/lib/vedeu/models/views/composition_test.rb +61 -0
  89. data/test/lib/vedeu/models/views/line_test.rb +189 -0
  90. data/test/lib/vedeu/models/views/lines_test.rb +22 -0
  91. data/test/lib/vedeu/models/views/stream_test.rb +138 -0
  92. data/test/lib/vedeu/models/views/streams_test.rb +22 -0
  93. data/test/lib/vedeu/models/views/view_test.rb +40 -0
  94. data/test/lib/vedeu/null/view_test.rb +12 -0
  95. data/test/lib/vedeu/output/clear/named_interface_test.rb +4 -4
  96. data/test/lib/vedeu/output/compressor_test.rb +28 -28
  97. data/test/lib/vedeu/output/html_char_test.rb +2 -2
  98. data/test/lib/vedeu/output/presentation_test.rb +10 -14
  99. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +20 -4
  100. data/test/lib/vedeu/output/renderers/html_test.rb +4 -4
  101. data/test/lib/vedeu/output/renderers/json_test.rb +3 -3
  102. data/test/lib/vedeu/output/text_test.rb +10 -10
  103. data/test/lib/vedeu/output/viewport_test.rb +21 -23
  104. data/test/lib/vedeu/output/virtual_buffer_test.rb +1 -1
  105. data/test/lib/vedeu/output/virtual_terminal_test.rb +1 -1
  106. data/test/lib/vedeu/output/wordwrap_test.rb +9 -9
  107. data/test/lib/vedeu/repositories/repository_test.rb +2 -2
  108. data/test/lib/vedeu/templating/helpers_test.rb +6 -39
  109. data/test/lib/vedeu/templating/template_test.rb +2 -2
  110. data/test/lib/vedeu/templating/view_template_test.rb +91 -91
  111. data/test/lib/vedeu/terminal_test.rb +1 -1
  112. metadata +33 -27
  113. data/lib/vedeu/buffers/display_buffer.rb +0 -39
  114. data/lib/vedeu/models/char.rb +0 -170
  115. data/lib/vedeu/models/chars.rb +0 -9
  116. data/lib/vedeu/models/composition.rb +0 -66
  117. data/lib/vedeu/models/line.rb +0 -112
  118. data/lib/vedeu/models/lines.rb +0 -9
  119. data/lib/vedeu/models/stream.rb +0 -122
  120. data/lib/vedeu/models/streams.rb +0 -9
  121. data/test/lib/vedeu/buffers/display_buffer_test.rb +0 -61
  122. data/test/lib/vedeu/models/char_test.rb +0 -253
  123. data/test/lib/vedeu/models/chars_test.rb +0 -18
  124. data/test/lib/vedeu/models/composition_test.rb +0 -57
  125. data/test/lib/vedeu/models/line_test.rb +0 -189
  126. data/test/lib/vedeu/models/lines_test.rb +0 -18
  127. data/test/lib/vedeu/models/stream_test.rb +0 -141
  128. data/test/lib/vedeu/models/streams_test.rb +0 -18
@@ -1,13 +1,13 @@
1
1
  module Vedeu
2
2
 
3
- # Represents a {Vedeu::Char} as a HTML tag with value. By default, a table
4
- # cell is used.
3
+ # Represents a {Vedeu::Views::Char} as a HTML tag with value. By default, a
4
+ # table cell is used.
5
5
  #
6
6
  class HTMLChar
7
7
 
8
8
  include Vedeu::Common
9
9
 
10
- # @param char [Vedeu::Char]
10
+ # @param char [Vedeu::Views::Char]
11
11
  # @param options [Hash<Symbol => String>]
12
12
  # @option options start_tag [String]
13
13
  # @option options end_tag [String]
@@ -18,7 +18,7 @@ module Vedeu
18
18
 
19
19
  # Returns a new instance of Vedeu::HTMLChar.
20
20
  #
21
- # @param char [Vedeu::Char]
21
+ # @param char [Vedeu::Views::Char]
22
22
  # @param options [Hash<Symbol => String>]
23
23
  # @option options start_tag [String]
24
24
  # @option options end_tag [String]
@@ -36,7 +36,7 @@ module Vedeu
36
36
  protected
37
37
 
38
38
  # @!attribute [r] char
39
- # @return [Vedeu::Char]
39
+ # @return [Vedeu::Views::Char]
40
40
  attr_reader :char
41
41
 
42
42
  private
@@ -90,7 +90,7 @@ module Vedeu
90
90
  @bg ||= colour(char, 'background', '#000')
91
91
  end
92
92
 
93
- # @param char [Vedeu::Char]
93
+ # @param char [Vedeu::Views::Char]
94
94
  # @param type [String]
95
95
  # @param default [String]
96
96
  # @return [String]
@@ -14,7 +14,7 @@ module Vedeu
14
14
 
15
15
  # Return a new instance of Vedeu::Output.
16
16
  #
17
- # @param output [Array<Array<Vedeu::Char>>]
17
+ # @param output [Array<Array<Vedeu::Views::Char>>]
18
18
  # @return [Output]
19
19
  def initialize(output)
20
20
  @output = output
@@ -30,13 +30,13 @@ module Vedeu
30
30
  # Vedeu::Renderers::HTML.to_file(Vedeu::VirtualBuffer.retrieve)
31
31
  end
32
32
 
33
- Vedeu.renderers.render(output)
33
+ Vedeu.renderers.render(output) if Vedeu.ready?
34
34
  end
35
35
 
36
36
  protected
37
37
 
38
38
  # @!attribute [r] output
39
- # @return [Array<Array<Vedeu::Char>>]
39
+ # @return [Array<Array<Vedeu::Views::Char>>]
40
40
  attr_reader :output
41
41
 
42
42
  end # Output
@@ -4,7 +4,7 @@ require 'vedeu/output/presentation/style'
4
4
  module Vedeu
5
5
 
6
6
  # This module allows the sharing of presentation concerns between the models:
7
- # Interface, Line and Stream.
7
+ # Interface, View, Line and Stream.
8
8
  #
9
9
  module Presentation
10
10
 
@@ -17,7 +17,7 @@ module Vedeu
17
17
 
18
18
  # Render the output with the escape sequences escaped.
19
19
  #
20
- # @param output [Array<Array<Vedeu::Char>>]
20
+ # @param output [Array<Array<Vedeu::Views::Char>>]
21
21
  # @return [String]
22
22
  def render(output)
23
23
  @parsed ||= Array(output).flatten.map do |char|
@@ -17,7 +17,7 @@ module Vedeu
17
17
  @options = options || {}
18
18
  end
19
19
 
20
- # @param output [Array<Array<Vedeu::Char>>]
20
+ # @param output [Array<Array<Vedeu::Views::Char>>]
21
21
  # @return [String]
22
22
  def render(output)
23
23
  ::File.write(filename, output) if write_file?
@@ -19,7 +19,7 @@ module Vedeu
19
19
  @options = options || {}
20
20
  end
21
21
 
22
- # @param output [Array<Array<Vedeu::Char>>]
22
+ # @param output [Array<Array<Vedeu::Views::Char>>]
23
23
  # @return [String]
24
24
  def render(output)
25
25
  @options[:content] = output
@@ -39,7 +39,7 @@ module Vedeu
39
39
  Array(content).each do |line|
40
40
  out << "#{start_row_tag}\n"
41
41
  line.each do |char|
42
- if char.is_a?(Vedeu::Char)
42
+ if char.is_a?(Vedeu::Views::Char)
43
43
  out << char.to_html
44
44
  out << "\n"
45
45
  end
@@ -51,7 +51,7 @@ module Vedeu
51
51
 
52
52
  private
53
53
 
54
- # @return [Array<Array<Vedeu::Char>>]
54
+ # @return [Array<Array<Vedeu::Views::Char>>]
55
55
  def content
56
56
  options[:content]
57
57
  end
@@ -14,7 +14,7 @@ module Vedeu
14
14
  @options = options || {}
15
15
  end
16
16
 
17
- # @param output [Array<Array<Vedeu::Char>>]
17
+ # @param output [Array<Array<Vedeu::Views::Char>>]
18
18
  # @return [String]
19
19
  def render(output)
20
20
  super(parsed(output))
@@ -22,7 +22,7 @@ module Vedeu
22
22
 
23
23
  private
24
24
 
25
- # @param output [Array<Array<Vedeu::Char>>]
25
+ # @param output [Array<Array<Vedeu::Views::Char>>]
26
26
  # @return [String]
27
27
  def parsed(output)
28
28
  return '' if output.nil? || output.empty?
@@ -30,13 +30,13 @@ module Vedeu
30
30
  ::JSON.pretty_generate(as_hash(output))
31
31
  end
32
32
 
33
- # @param output [Array<Array<Vedeu::Char>>]
33
+ # @param output [Array<Array<Vedeu::Views::Char>>]
34
34
  # @return [Array]
35
35
  def as_hash(output)
36
36
  sorted(output).map(&:to_hash)
37
37
  end
38
38
 
39
- # @param output [Array<Array<Vedeu::Char>>]
39
+ # @param output [Array<Array<Vedeu::Views::Char>>]
40
40
  # @return [Array]
41
41
  def sorted(output)
42
42
  Array(output).flatten.sort { |a, b| a.position <=> b.position }
@@ -16,7 +16,7 @@ module Vedeu
16
16
  @options = options || {}
17
17
  end
18
18
 
19
- # @param output [Array<Array<Vedeu::Char>>]
19
+ # @param output [Array<Array<Vedeu::Views::Char>>]
20
20
  # @return [String]
21
21
  def render(output)
22
22
  output
@@ -2,8 +2,8 @@ module Vedeu
2
2
 
3
3
  module Renderers
4
4
 
5
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
- # and content suitable for a terminal.
5
+ # Converts a grid of {Vedeu::Views::Char} objects into a stream of escape
6
+ # sequences and content suitable for a terminal.
7
7
  #
8
8
  class Terminal
9
9
 
@@ -17,7 +17,7 @@ module Vedeu
17
17
  @options = options || {}
18
18
  end
19
19
 
20
- # @param output [Array<Array<Vedeu::Char>>]
20
+ # @param output [Array<Array<Vedeu::Views::Char>>]
21
21
  # @return [Array<String>]
22
22
  def render(output)
23
23
  Vedeu::Terminal.output(parsed(output))
@@ -25,8 +25,8 @@ module Vedeu
25
25
 
26
26
  private
27
27
 
28
- # @param output [Array<Array<Vedeu::Char>>]
29
- # @return [Array<Array<Vedeu::Char>>]
28
+ # @param output [Array<Array<Vedeu::Views::Char>>]
29
+ # @return [Array<Array<Vedeu::Views::Char>>]
30
30
  def parsed(output)
31
31
  Vedeu.timer('Compression') do
32
32
  Vedeu::Compressor.render(output)
@@ -2,8 +2,8 @@ module Vedeu
2
2
 
3
3
  module Renderers
4
4
 
5
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
- # and content.
5
+ # Converts a grid of {Vedeu::Views::Char} objects into a stream of escape
6
+ # sequences and content.
7
7
  #
8
8
  class Text
9
9
 
@@ -17,7 +17,7 @@ module Vedeu
17
17
  @options = options || {}
18
18
  end
19
19
 
20
- # @param output [Array<Array<Vedeu::Char>>]
20
+ # @param output [Array<Array<Vedeu::Views::Char>>]
21
21
  # @return [String]
22
22
  def render(output)
23
23
  Vedeu::Compressor.render(output)
@@ -56,7 +56,7 @@ module Vedeu
56
56
 
57
57
  # An object is equal when its values are the same.
58
58
  #
59
- # @param other [Vedeu::Char]
59
+ # @param other [Vedeu::Views::Char]
60
60
  # @return [Boolean]
61
61
  def eql?(other)
62
62
  self.class == other.class && value == other.value
@@ -22,7 +22,8 @@ module Vedeu
22
22
  # @option options background [String]
23
23
  # @option options colour [Hash|NilClass]
24
24
  # @option options foreground [String]
25
- # @option options model [Vedeu::Interface|Vedeu::Line|Vedeu::Stream]
25
+ # @option options model
26
+ # [Vedeu::Views::View|Vedeu::Views::Line|Vedeu::Views::Stream]
26
27
  # @option options pad [String]
27
28
  # @option options width [Integer]
28
29
  # @return [Vedeu::Text]
@@ -80,7 +81,7 @@ module Vedeu
80
81
  end
81
82
 
82
83
  # If a colour, background or foreground option is set, use them as the
83
- # colour settings for the new Vedeu::Stream.
84
+ # colour settings for the new Vedeu::Views::Stream.
84
85
  #
85
86
  # @return [void]
86
87
  def colour
@@ -93,11 +94,12 @@ module Vedeu
93
94
  end
94
95
  end
95
96
 
96
- # Returns either a Vedeu::Line or Vedeu::Stream containing the text value.
97
+ # Returns either a Vedeu::Views::Line or Vedeu::Views::Stream containing the
98
+ # text value.
97
99
  #
98
- # @return [Vedeu::Line|Vedeu::Stream]
100
+ # @return [Vedeu::Views::Line|Vedeu::Views::Stream]
99
101
  def content
100
- if model.is_a?(Vedeu::Interface)
102
+ if model.is_a?(Vedeu::Views::View)
101
103
  stream.parent = line
102
104
  line.add(stream)
103
105
  line
@@ -128,14 +130,17 @@ module Vedeu
128
130
  string.ljust(width, pad)
129
131
  end
130
132
 
131
- # @return [Vedeu::Line]
133
+ # @return [Vedeu::Views::Line]
132
134
  def line
133
- @line ||= Vedeu::Line.build(parent: parent)
135
+ @line ||= Vedeu::Views::Line.build(parent: parent)
134
136
  end
135
137
 
136
138
  # Returns the model option when set.
137
139
  #
138
- # @return [Vedeu::Interface|Vedeu::Line|Vedeu::Null::Generic|Vedeu::Stream]
140
+ # @return [Vedeu::Views::View|
141
+ # Vedeu::Views::Line|
142
+ # Vedeu::Null::Generic|
143
+ # Vedeu::Views::Stream]
139
144
  def model
140
145
  @model ||= options[:model] || Vedeu::Null::Generic.new
141
146
  end
@@ -147,11 +152,11 @@ module Vedeu
147
152
  options[:pad]
148
153
  end
149
154
 
150
- # Returns the parent for the new Vedeu::Stream.
155
+ # Returns the parent for the new Vedeu::Views::Stream.
151
156
  #
152
157
  # @return [void]
153
158
  def parent
154
- model.is_a?(Vedeu::Stream) ? model.parent : model
159
+ model.is_a?(Vedeu::Views::Stream) ? model.parent : model
155
160
  end
156
161
 
157
162
  # The string padded to width, right justified.
@@ -161,14 +166,14 @@ module Vedeu
161
166
  string.rjust(width, pad)
162
167
  end
163
168
 
164
- # Builds and returns a new Vedeu::Stream.
169
+ # Builds and returns a new Vedeu::Views::Stream.
165
170
  #
166
171
  # @return [void]
167
172
  def stream
168
- @stream ||= Vedeu::Stream.build(colour: colour,
169
- parent: parent,
170
- style: style,
171
- value: aligned)
173
+ @stream ||= Vedeu::Views::Stream.build(colour: colour,
174
+ parent: parent,
175
+ style: style,
176
+ value: aligned)
172
177
  end
173
178
 
174
179
  # The string, coerced.
@@ -10,7 +10,7 @@ module Vedeu
10
10
 
11
11
  extend Forwardable
12
12
 
13
- def_delegators :interface,
13
+ def_delegators :view,
14
14
  :lines,
15
15
  :lines?,
16
16
  :name,
@@ -24,28 +24,21 @@ module Vedeu
24
24
  :ox,
25
25
  :oy
26
26
 
27
- # @param interface [Vedeu::Interface]
28
- # @return [Array<Array<Vedeu::Char>>]
29
- def self.render(interface)
30
- if interface.visible?
31
- new(interface).render
32
-
33
- else
34
- []
35
-
36
- end
27
+ # @param view [Vedeu::Views::View]
28
+ # @return [Array<Array<Vedeu::Views::Char>>]
29
+ def self.render(view)
30
+ new(view).render
37
31
  end
38
32
 
39
33
  # Returns an instance of Vedeu::Viewport.
40
34
  #
41
- # @param interface [Vedeu::Interface] An instance of interface.
42
- # @return [Viewport]
43
- def initialize(interface)
44
- @interface = interface
35
+ # @param view [Vedeu::Views::View]
36
+ # @return [Vedeu::Viewport]
37
+ def initialize(view)
38
+ @view = view
45
39
  end
46
40
 
47
- # Returns the interface with border (when enabled) and the content for the
48
- # interface.
41
+ # Returns the content for the view.
49
42
  #
50
43
  # @return [Array<Array<String>>]
51
44
  def render
@@ -75,13 +68,13 @@ module Vedeu
75
68
 
76
69
  protected
77
70
 
78
- # @!attribute [r] interface
79
- # @return [Vedeu::Interface]
80
- attr_reader :interface
71
+ # @!attribute [r] view
72
+ # @return [Vedeu::Views::View]
73
+ attr_reader :view
81
74
 
82
75
  private
83
76
 
84
- # Returns the visible content for the interface.
77
+ # Returns the visible content for the view.
85
78
  #
86
79
  # @note If there are no lines of content, we return an empty array. If there
87
80
  # are no more columns of content we return a space enclosed in an array;
@@ -148,7 +141,7 @@ module Vedeu
148
141
  end
149
142
  end
150
143
 
151
- # Return the border associated with the interface we are drawing.
144
+ # Return the border associated with the interface/view we are drawing.
152
145
  #
153
146
  # @return (see Vedeu::Borders#by_name)
154
147
  def border
@@ -165,7 +158,7 @@ module Vedeu
165
158
  @by ||= border.by
166
159
  end
167
160
 
168
- # Fetch the cursor associated with the interface we are drawing.
161
+ # Fetch the cursor associated with the interface/view we are drawing.
169
162
  #
170
163
  # @return (see Vedeu::Cursors#by_name)
171
164
  def cursor
@@ -3,14 +3,15 @@ module Vedeu
3
3
  # Store and retrieve {Vedeu::VirtualTerminal} objects.
4
4
  #
5
5
  # Each {Vedeu::VirtualTerminal} object is a copy of the current terminal
6
- # including content but not as String objects but {Vedeu::Char} objects. Using
7
- # {Vedeu::Char} objects means that we can store the data used to make up the
8
- # displayed character, complete with its colour, position and style.
6
+ # including content but not as String objects but {Vedeu::Views::Char}
7
+ # objects. Using {Vedeu::Views::Char} objects means that we can store the data
8
+ # used to make up the displayed character, complete with its colour, position
9
+ # and style.
9
10
  #
10
- # Once a {Vedeu::Char} has been converted to a String, it is tricky to
11
+ # Once a {Vedeu::Views::Char} has been converted to a String, it is tricky to
11
12
  # separate the escape sequences and string data. By deferring this conversion
12
- # we can display the {Vedeu::Char} in multiple ways (e.g. HTML) or in multiple
13
- # formats (e.g. JSON), and render/use that in an appropriate way.
13
+ # we can display the {Vedeu::Views::Char} in multiple ways (e.g. HTML) or in
14
+ # multiple formats (e.g. JSON), and render/use that in an appropriate way.
14
15
  #
15
16
  module VirtualBuffer
16
17
 
@@ -18,7 +19,7 @@ module Vedeu
18
19
 
19
20
  # Fetch the oldest stored virtual buffer first.
20
21
  #
21
- # @return [Array<Array<Vedeu::Char>>|NilClass]
22
+ # @return [Array<Array<Vedeu::Views::Char>>|NilClass]
22
23
  def retrieve
23
24
  Vedeu.log(type: :drb, message: 'Retrieving output')
24
25
 
@@ -27,7 +28,7 @@ module Vedeu
27
28
 
28
29
  # Store a new virtual buffer.
29
30
  #
30
- # @return [Array<Array<Vedeu::Char>>]
31
+ # @return [Array<Array<Vedeu::Views::Char>>]
31
32
  def store(data)
32
33
  Vedeu.log(type: :drb, message: 'Storing output')
33
34
 
@@ -29,10 +29,10 @@ module Vedeu
29
29
  @renderer = renderer
30
30
  end
31
31
 
32
- # Return a grid of {Vedeu::Char} objects defined by the height and width of
33
- # this virtual terminal.
32
+ # Return a grid of {Vedeu::Views::Char} objects defined by the height and
33
+ # width of this virtual terminal.
34
34
  #
35
- # @return [Array<Array<Vedeu::Char>>]
35
+ # @return [Array<Array<Vedeu::Views::Char>>]
36
36
  def cells
37
37
  @cells ||= new_virtual_terminal
38
38
  end
@@ -46,7 +46,7 @@ module Vedeu
46
46
  #
47
47
  # @param y [Fixnum] The row/line coordinate.
48
48
  # @param x [Fixnum] The column/character coordinate.
49
- # @return [Vedeu::Char]
49
+ # @return [Vedeu::Views::Char]
50
50
  def read(y, x)
51
51
  cy, cx = Vedeu::PositionIndex[y, x]
52
52
 
@@ -58,11 +58,11 @@ module Vedeu
58
58
 
59
59
  # Write a collection of cells to the virtual terminal.
60
60
  #
61
- # @param data [Array<Array<Vedeu::Char>>]
62
- # @return [Array<Array<Vedeu::Char>>]
61
+ # @param data [Array<Array<Vedeu::Views::Char>>]
62
+ # @return [Array<Array<Vedeu::Views::Char>>]
63
63
  def output(data)
64
64
  Array(data).flatten.each do |char|
65
- write(char.y, char.x, char) if char.is_a?(Vedeu::Char)
65
+ write(char.y, char.x, char) if char.is_a?(Vedeu::Views::Char)
66
66
  end
67
67
 
68
68
  cells
@@ -77,7 +77,7 @@ module Vedeu
77
77
 
78
78
  # Removes all content from the virtual terminal; effectively clearing it.
79
79
  #
80
- # @return [Array<Array<Vedeu::Char>>]
80
+ # @return [Array<Array<Vedeu::Views::Char>>]
81
81
  def reset
82
82
  @cells = new_virtual_terminal
83
83
  end
@@ -91,8 +91,8 @@ module Vedeu
91
91
  #
92
92
  # @param y [Fixnum] The row/line coordinate.
93
93
  # @param x [Fixnum] The column/character coordinate.
94
- # @param data [Vedeu::Char]
95
- # @return [Vedeu::Char]
94
+ # @param data [Vedeu::Views::Char]
95
+ # @return [Vedeu::Views::Char]
96
96
  def write(y, x, data)
97
97
  return false unless read(y, x).is_a?(Vedeu::Cell)
98
98
 
@@ -107,7 +107,7 @@ module Vedeu
107
107
  # @param from [Array] An Array of rows, or an Array of cells.
108
108
  # @param which [Fixnum] A Fixnum representing the index; the row number or
109
109
  # the cell number for a row.
110
- # @return [Array<Vedeu::Char>|Array]
110
+ # @return [Array<Vedeu::Views::Char>|Array]
111
111
  def fetch(from, which)
112
112
  from[which] || []
113
113
  end