vedeu 0.4.18 → 0.4.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Rakefile +1 -0
  4. data/bin/vedeu_drb_server +0 -1
  5. data/bin/vedeu_test +0 -1
  6. data/config/rubocop_enabled.yml +1 -1
  7. data/examples/borders_app.rb +0 -1
  8. data/examples/colours_app.rb +0 -1
  9. data/examples/cursor_app.rb +0 -1
  10. data/examples/drb_app.rb +0 -1
  11. data/examples/geometry_app.rb +0 -1
  12. data/examples/hello_world.rb +0 -1
  13. data/examples/lines_app.rb +0 -1
  14. data/examples/material_colours_app.rb +0 -1
  15. data/examples/typed_commands/typed_commands_app.rb +0 -1
  16. data/examples/view_templates_app/view_templates_app.rb +0 -1
  17. data/lib/vedeu/api.rb +2 -1
  18. data/lib/vedeu/application.rb +3 -2
  19. data/lib/vedeu/bindings.rb +3 -5
  20. data/lib/vedeu/buffers/buffer.rb +8 -11
  21. data/lib/vedeu/buffers/display_buffer.rb +0 -2
  22. data/lib/vedeu/configuration/api.rb +1 -4
  23. data/lib/vedeu/configuration/cli.rb +153 -74
  24. data/lib/vedeu/configuration/configuration.rb +1 -2
  25. data/lib/vedeu/cursor/cursor.rb +0 -4
  26. data/lib/vedeu/cursor/move.rb +3 -6
  27. data/lib/vedeu/cursor/refresh_cursor.rb +12 -2
  28. data/lib/vedeu/distributed/client.rb +3 -2
  29. data/lib/vedeu/distributed/server.rb +4 -3
  30. data/lib/vedeu/distributed/subprocess.rb +3 -4
  31. data/lib/vedeu/distributed/test_application.rb +0 -1
  32. data/lib/vedeu/distributed/uri.rb +0 -1
  33. data/lib/vedeu/dsl/components/border.rb +3 -4
  34. data/lib/vedeu/dsl/components/geometry.rb +1 -5
  35. data/lib/vedeu/dsl/components/keymap.rb +1 -3
  36. data/lib/vedeu/dsl/components/menu.rb +1 -2
  37. data/lib/vedeu/dsl/composition.rb +3 -4
  38. data/lib/vedeu/dsl/group.rb +1 -4
  39. data/lib/vedeu/dsl/interface.rb +3 -10
  40. data/lib/vedeu/dsl/line.rb +3 -4
  41. data/lib/vedeu/dsl/shared/text.rb +0 -3
  42. data/lib/vedeu/dsl/stream.rb +3 -4
  43. data/lib/vedeu/dsl/view.rb +0 -3
  44. data/lib/vedeu/events/event.rb +3 -3
  45. data/lib/vedeu/events/trigger.rb +3 -2
  46. data/lib/vedeu/geometry/area.rb +0 -1
  47. data/lib/vedeu/geometry/canvas.rb +0 -1
  48. data/lib/vedeu/geometry/coordinate.rb +6 -7
  49. data/lib/vedeu/geometry/dimension.rb +3 -2
  50. data/lib/vedeu/geometry/geometry.rb +0 -6
  51. data/lib/vedeu/geometry/grid.rb +3 -2
  52. data/lib/vedeu/geometry/index_position.rb +0 -1
  53. data/lib/vedeu/geometry/position.rb +0 -1
  54. data/lib/vedeu/geometry/position_index.rb +0 -1
  55. data/lib/vedeu/geometry/position_validator.rb +6 -68
  56. data/lib/vedeu/input/all.rb +0 -2
  57. data/lib/vedeu/input/input.rb +3 -2
  58. data/lib/vedeu/input/key.rb +0 -1
  59. data/lib/vedeu/input/keymap.rb +4 -7
  60. data/lib/vedeu/input/mapper.rb +3 -2
  61. data/lib/vedeu/launcher.rb +3 -2
  62. data/lib/vedeu/main_loop.rb +1 -1
  63. data/lib/vedeu/models/cell.rb +0 -1
  64. data/lib/vedeu/models/char.rb +0 -1
  65. data/lib/vedeu/models/composition.rb +1 -7
  66. data/lib/vedeu/models/group.rb +0 -3
  67. data/lib/vedeu/models/interface.rb +0 -3
  68. data/lib/vedeu/models/line.rb +0 -4
  69. data/lib/vedeu/models/menu.rb +5 -8
  70. data/lib/vedeu/models/stream.rb +0 -4
  71. data/lib/vedeu/null/all.rb +11 -0
  72. data/lib/vedeu/null/border.rb +3 -1
  73. data/lib/vedeu/null/buffer.rb +0 -1
  74. data/lib/vedeu/null/generic.rb +4 -1
  75. data/lib/vedeu/null/geometry.rb +0 -1
  76. data/lib/vedeu/null/interface.rb +36 -7
  77. data/lib/vedeu/output/background.rb +0 -1
  78. data/lib/vedeu/output/border.rb +1 -6
  79. data/lib/vedeu/output/clear.rb +3 -2
  80. data/lib/vedeu/output/colour.rb +6 -18
  81. data/lib/vedeu/output/compressor.rb +5 -2
  82. data/lib/vedeu/output/esc.rb +4 -1
  83. data/lib/vedeu/output/foreground.rb +0 -5
  84. data/lib/vedeu/output/html_char.rb +3 -2
  85. data/lib/vedeu/output/output.rb +1 -5
  86. data/lib/vedeu/output/refresh.rb +1 -1
  87. data/lib/vedeu/output/renderers/all.rb +0 -1
  88. data/lib/vedeu/output/renderers/escape_sequence.rb +3 -2
  89. data/lib/vedeu/output/renderers/file.rb +85 -80
  90. data/lib/vedeu/output/renderers/html.rb +77 -72
  91. data/lib/vedeu/output/renderers/json.rb +45 -42
  92. data/lib/vedeu/output/renderers/null.rb +11 -8
  93. data/lib/vedeu/output/renderers/terminal.rb +41 -36
  94. data/lib/vedeu/output/renderers/text.rb +41 -36
  95. data/lib/vedeu/output/style.rb +0 -3
  96. data/lib/vedeu/output/text.rb +3 -2
  97. data/lib/vedeu/output/viewport.rb +3 -2
  98. data/lib/vedeu/output/virtual_terminal.rb +0 -1
  99. data/lib/vedeu/output/wordwrap.rb +3 -2
  100. data/lib/vedeu/repositories/all.rb +7 -6
  101. data/lib/vedeu/repositories/collection.rb +0 -1
  102. data/lib/vedeu/repositories/collections/chars.rb +0 -1
  103. data/lib/vedeu/repositories/collections/events.rb +0 -1
  104. data/lib/vedeu/repositories/collections/interfaces.rb +0 -1
  105. data/lib/vedeu/repositories/collections/keys.rb +0 -1
  106. data/lib/vedeu/repositories/collections/lines.rb +0 -1
  107. data/lib/vedeu/repositories/collections/streams.rb +0 -1
  108. data/lib/vedeu/repositories/model.rb +0 -1
  109. data/lib/vedeu/repositories/registerable.rb +29 -0
  110. data/lib/vedeu/repositories/repositories/background_colours.rb +0 -1
  111. data/lib/vedeu/repositories/repositories/borders.rb +2 -13
  112. data/lib/vedeu/repositories/repositories/buffers.rb +2 -13
  113. data/lib/vedeu/repositories/repositories/colours.rb +0 -1
  114. data/lib/vedeu/repositories/repositories/cursors.rb +1 -2
  115. data/lib/vedeu/repositories/repositories/events_repository.rb +0 -1
  116. data/lib/vedeu/repositories/repositories/foreground_colours.rb +0 -1
  117. data/lib/vedeu/repositories/repositories/geometries.rb +2 -13
  118. data/lib/vedeu/repositories/repositories/groups.rb +1 -2
  119. data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -14
  120. data/lib/vedeu/repositories/repositories/keymaps.rb +1 -2
  121. data/lib/vedeu/repositories/repositories/menus.rb +1 -2
  122. data/lib/vedeu/repositories/repository.rb +14 -5
  123. data/lib/vedeu/storage/all.rb +0 -1
  124. data/lib/vedeu/storage/associative_store.rb +0 -1
  125. data/lib/vedeu/storage/conveyor_store.rb +0 -1
  126. data/lib/vedeu/storage/fifo_store.rb +0 -1
  127. data/lib/vedeu/support/log.rb +0 -3
  128. data/lib/vedeu/support/options.rb +3 -2
  129. data/lib/vedeu/support/template.rb +3 -4
  130. data/lib/vedeu/support/terminal.rb +0 -2
  131. data/lib/vedeu/support/trace.rb +6 -7
  132. data/lib/vedeu/support/visibility.rb +1 -2
  133. data/lib/vedeu.rb +3 -5
  134. data/test/lib/vedeu/buffers/buffer_test.rb +48 -13
  135. data/test/lib/vedeu/configuration/cli_test.rb +5 -4
  136. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +37 -15
  137. data/test/lib/vedeu/distributed/subprocess_test.rb +1 -0
  138. data/test/lib/vedeu/dsl/shared/use_test.rb +1 -6
  139. data/test/lib/vedeu/main_loop_test.rb +11 -0
  140. data/test/lib/vedeu/null/interface_test.rb +27 -0
  141. data/test/lib/vedeu/output/output_test.rb +17 -10
  142. data/test/lib/vedeu/output/presentation_test.rb +35 -7
  143. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +50 -0
  144. data/test/lib/vedeu/output/renderers/file_test.rb +34 -30
  145. data/test/lib/vedeu/output/renderers/html_test.rb +61 -57
  146. data/test/lib/vedeu/output/renderers/json_test.rb +40 -36
  147. data/test/lib/vedeu/output/renderers/null_test.rb +12 -8
  148. data/test/lib/vedeu/output/renderers/terminal_test.rb +17 -13
  149. data/test/lib/vedeu/output/renderers/text_test.rb +17 -13
  150. data/test/lib/vedeu/repositories/model_test.rb +1 -1
  151. data/test/lib/vedeu/repositories/registerable_test.rb +28 -0
  152. data/test/lib/vedeu/storage/associative_store_test.rb +7 -0
  153. data/test/lib/vedeu/storage/conveyor_store_test.rb +7 -0
  154. data/test/lib/vedeu/storage/fifo_store_test.rb +7 -0
  155. data/test/support/helpers/model_test_class.rb +6 -2
  156. data/test/test_helper.rb +2 -0
  157. data/vedeu.gemspec +3 -2
  158. metadata +23 -6
  159. data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +0 -46
@@ -1,86 +1,91 @@
1
1
  module Vedeu
2
2
 
3
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
4
- # and content suitable for a terminal, and writes them to a file in the /tmp
5
- # directory.
6
- #
7
- class Renderers::File
8
-
9
- # @param output [Array<Array<Vedeu::Char>>]
10
- # @param options [Hash]
11
- # @return [String]
12
- def self.render(output, options = {})
13
- new(output, options).render
14
- end
15
-
16
- # Returns a new instance of Vedeu::Renderers::File.
17
- #
18
- # @param output [Array<Array<Vedeu::Char>>]
19
- # @param options [Hash]
20
- # @return [Vedeu::Renderers::File]
21
- def initialize(output, options = {})
22
- @output = output
23
- @options = options
24
- end
25
-
26
- # @return [String]
27
- def render
28
- File.open(path, 'w') { |f| f.write(parsed) }
29
-
30
- parsed
31
- end
32
-
33
- private
34
-
35
- # @!attribute [r] output
36
- # @return [Array<Array<Vedeu::Char>>]
37
- attr_reader :output
38
-
39
- # @return [String]
40
- def path
41
- "/tmp/#{filename}"
42
- end
43
-
44
- # @return [String]
45
- def filename
46
- if timestamp?
47
- "out_#{timestamp}"
48
-
49
- else
50
- 'out'
3
+ module Renderers
4
+
5
+ # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
+ # and content suitable for a terminal, and writes them to a file in the /tmp
7
+ # directory.
8
+ class File
9
+
10
+ # @param output [Array<Array<Vedeu::Char>>]
11
+ # @param options [Hash]
12
+ # @return [String]
13
+ def self.render(output, options = {})
14
+ new(output, options).render
15
+ end
16
+
17
+ # Returns a new instance of Vedeu::Renderers::File.
18
+ #
19
+ # @param output [Array<Array<Vedeu::Char>>]
20
+ # @param options [Hash]
21
+ # @return [Vedeu::Renderers::File]
22
+ def initialize(output, options = {})
23
+ @output = output
24
+ @options = options
25
+ end
26
+
27
+ # @return [String]
28
+ def render
29
+ ::File.open(path, 'w') { |f| f.write(parsed) }
30
+
31
+ parsed
32
+ end
33
+
34
+ protected
35
+
36
+ # @!attribute [r] output
37
+ # @return [Array<Array<Vedeu::Char>>]
38
+ attr_reader :output
39
+
40
+ private
41
+
42
+ # @return [String]
43
+ def path
44
+ "/tmp/#{filename}"
45
+ end
46
+
47
+ # @return [String]
48
+ def filename
49
+ if timestamp?
50
+ "out_#{timestamp}"
51
+
52
+ else
53
+ 'out'
51
54
 
55
+ end
52
56
  end
53
- end
54
-
55
- # @return [String]
56
- def parsed
57
- @parsed ||= Vedeu::Compressor.new(output).render
58
- end
59
-
60
- # @return [Float]
61
- def timestamp
62
- @timestamp ||= Time.now.to_f
63
- end
64
-
65
- # @return [Boolean]
66
- def timestamp?
67
- return true if options[:timestamp]
68
-
69
- false
70
- end
71
-
72
- # @return [Hash]
73
- def options
74
- defaults.merge!(@options)
75
- end
76
-
77
- # @return [Hash]
78
- def defaults
79
- {
80
- timestamp: false,
81
- }
82
- end
83
-
84
- end # Renderers::File
57
+
58
+ # @return [String]
59
+ def parsed
60
+ @parsed ||= Vedeu::Compressor.new(output).render
61
+ end
62
+
63
+ # @return [Float]
64
+ def timestamp
65
+ @timestamp ||= Time.now.to_f
66
+ end
67
+
68
+ # @return [Boolean]
69
+ def timestamp?
70
+ return true if options[:timestamp]
71
+
72
+ false
73
+ end
74
+
75
+ # @return [Hash]
76
+ def options
77
+ defaults.merge!(@options)
78
+ end
79
+
80
+ # @return [Hash]
81
+ def defaults
82
+ {
83
+ timestamp: false,
84
+ }
85
+ end
86
+
87
+ end # File
88
+
89
+ end # Renderers
85
90
 
86
91
  end # Vedeu
@@ -1,85 +1,90 @@
1
1
  module Vedeu
2
2
 
3
- # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as a HTML table.
4
- #
5
- class Renderers::HTML
6
-
7
- # @param output [Array<Array<Vedeu::Char>>]
8
- # @return [String]
9
- def self.render(output)
10
- new(output).to_file
11
- end
12
-
13
- # @param output [Array<Array<Vedeu::Char>>]
14
- # @param path [String]
15
- # @return [String]
16
- def self.to_file(output, path = nil)
17
- new(output).to_file(path)
18
- end
19
-
20
- # Returns a new instance of Vedeu::Renderers::HTML.
21
- #
22
- # @param output [Array<Array<Vedeu::Char>>]
23
- # @return [Vedeu::Renderers::HTML]
24
- def initialize(output)
25
- @output = output
26
- end
27
-
28
- # @return [String]
29
- def render
30
- Vedeu::Template.parse(self, template)
31
- end
32
-
33
- # Writes the parsed template to a file (at the given path) and returns the
34
- # contents.
35
- #
36
- # @param path [String]
37
- # @return [String]
38
- def to_file(path = file_path)
39
- content = render
40
-
41
- File.open(path, 'w') { |file| file.write(content) }
42
-
43
- content
44
- end
45
-
46
- # @return [String]
47
- def html_body
48
- out = ''
49
- Array(output).each do |line|
50
- out << "<tr>\n"
51
- line.each do |char|
52
- if char.is_a?(Vedeu::Char)
53
- out << char.to_html
54
- out << "\n"
3
+ module Renderers
4
+
5
+ # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as a HTML table.
6
+ class HTML
7
+
8
+ # @param output [Array<Array<Vedeu::Char>>]
9
+ # @return [String]
10
+ def self.render(output)
11
+ new(output).to_file
12
+ end
13
+
14
+ # @param output [Array<Array<Vedeu::Char>>]
15
+ # @param path [String]
16
+ # @return [String]
17
+ def self.to_file(output, path = nil)
18
+ new(output).to_file(path)
19
+ end
20
+
21
+ # Returns a new instance of Vedeu::Renderers::HTML.
22
+ #
23
+ # @param output [Array<Array<Vedeu::Char>>]
24
+ # @return [Vedeu::Renderers::HTML]
25
+ def initialize(output)
26
+ @output = output
27
+ end
28
+
29
+ # @return [String]
30
+ def render
31
+ Vedeu::Template.parse(self, template)
32
+ end
33
+
34
+ # Writes the parsed template to a file (at the given path) and returns the
35
+ # contents.
36
+ #
37
+ # @param path [String]
38
+ # @return [String]
39
+ def to_file(path = file_path)
40
+ content = render
41
+
42
+ ::File.open(path, 'w') { |file| file.write(content) }
43
+
44
+ content
45
+ end
46
+
47
+ # @return [String]
48
+ def html_body
49
+ out = ''
50
+ Array(output).each do |line|
51
+ out << "<tr>\n"
52
+ line.each do |char|
53
+ if char.is_a?(Vedeu::Char)
54
+ out << char.to_html
55
+ out << "\n"
56
+ end
55
57
  end
58
+ out << "</tr>\n"
56
59
  end
57
- out << "</tr>\n"
60
+ out
58
61
  end
59
- out
60
- end
61
62
 
62
- private
63
+ protected
63
64
 
64
- # @!attribute [r] output
65
- # @return [Array<Array<Vedeu::Char>>]
66
- attr_reader :output
65
+ # @!attribute [r] output
66
+ # @return [Array<Array<Vedeu::Char>>]
67
+ attr_reader :output
67
68
 
68
- # @return [String]
69
- def template
70
- File.dirname(__FILE__) + '/../templates/html_renderer.vedeu'
71
- end
69
+ private
72
70
 
73
- # @return [String]
74
- def file_path
75
- "/tmp/vedeu_html_#{timestamp}.html"
76
- end
71
+ # @return [String]
72
+ def template
73
+ ::File.dirname(__FILE__) + '/../templates/html_renderer.vedeu'
74
+ end
75
+
76
+ # @return [String]
77
+ def file_path
78
+ "/tmp/vedeu_html_#{timestamp}.html"
79
+ end
80
+
81
+ # return [Fixnum]
82
+ def timestamp
83
+ @timestamp ||= Time.now.to_i
84
+ end
77
85
 
78
- # return [Fixnum]
79
- def timestamp
80
- @timestamp ||= Time.now.to_i
81
- end
86
+ end # HTML
82
87
 
83
- end # Renderers::HTML
88
+ end # Renderers
84
89
 
85
90
  end # Vedeu
@@ -1,52 +1,55 @@
1
1
  module Vedeu
2
2
 
3
- # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as JSON.
4
- #
5
- class Renderers::JSON
6
-
7
- # @param output [Array<Array<Vedeu::Char>>]
8
- # @return [String]
9
- def self.render(output)
10
- new(output).render
11
- end
12
-
13
- # @param output [Array<Array<Vedeu::Char>>]
14
- # @param path [String]
15
- # @return [String]
16
- # def self.to_file(output, path = nil)
17
- # new(output).to_file(path)
18
- # end
19
-
20
- # Returns a new instance of Vedeu::Renderers::JSON.
21
- #
22
- # @param output [Array<Array<Vedeu::Char>>]
23
- # @return [Vedeu::Renderers::JSON]
24
- def initialize(output)
25
- @output = output
26
- end
27
-
28
- # @return [String]
29
- def render
30
- return '' if output.nil? || output.empty?
31
-
32
- out = ''
33
- Array(output).each do |line|
34
- out << ''
35
- line.each do |char|
36
- out << char.to_json
3
+ module Renderers
4
+
5
+ # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as JSON.
6
+ class JSON
7
+
8
+ # @param output [Array<Array<Vedeu::Char>>]
9
+ # @return [String]
10
+ def self.render(output)
11
+ new(output).render
12
+ end
13
+
14
+ # @param output [Array<Array<Vedeu::Char>>]
15
+ # @param path [String]
16
+ # @return [String]
17
+ # def self.to_file(output, path = nil)
18
+ # new(output).to_file(path)
19
+ # end
20
+
21
+ # Returns a new instance of Vedeu::Renderers::JSON.
22
+ #
23
+ # @param output [Array<Array<Vedeu::Char>>]
24
+ # @return [Vedeu::Renderers::JSON]
25
+ def initialize(output)
26
+ @output = output
27
+ end
28
+
29
+ # @return [String]
30
+ def render
31
+ return '' if output.nil? || output.empty?
32
+
33
+ out = ''
34
+ Array(output).each do |line|
35
+ out << ''
36
+ line.each do |char|
37
+ out << char.to_json
38
+ out << "\n"
39
+ end
37
40
  out << "\n"
38
41
  end
39
- out << "\n"
42
+ out
40
43
  end
41
- out
42
- end
43
44
 
44
- private
45
+ protected
46
+
47
+ # @!attribute [r] output
48
+ # @return [Array<Array<Vedeu::Char>>]
49
+ attr_reader :output
45
50
 
46
- # @!attribute [r] output
47
- # @return [Array<Array<Vedeu::Char>>]
48
- attr_reader :output
51
+ end # JSON
49
52
 
50
- end # Renderers::JSON
53
+ end # Renderers
51
54
 
52
55
  end # Vedeu
@@ -1,14 +1,17 @@
1
1
  module Vedeu
2
2
 
3
- # A renderer which returns nothing.
4
- #
5
- class Renderers::Null
3
+ module Renderers
6
4
 
7
- # @return [NilClass]
8
- def self.render(*)
9
- nil
10
- end
5
+ # A renderer which returns nothing.
6
+ class Null
11
7
 
12
- end # Renderers::Null
8
+ # @return [NilClass]
9
+ def self.render(*)
10
+ nil
11
+ end
12
+
13
+ end # Null
14
+
15
+ end # Renderers
13
16
 
14
17
  end # Vedeu
@@ -1,40 +1,45 @@
1
1
  module Vedeu
2
2
 
3
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
4
- # and content suitable for a terminal.
5
- #
6
- class Renderers::Terminal
7
-
8
- # @param output [Array<Array<Vedeu::Char>>]
9
- # @return [String]
10
- def self.render(*output)
11
- new(*output).render
12
- end
13
-
14
- # Returns a new instance of Vedeu::Renderers::Terminal.
15
- #
16
- # @param output [Array<Array<Vedeu::Char>>]
17
- # @return [Vedeu::Renderers::Terminal]
18
- def initialize(*output)
19
- @output = output
20
- end
21
-
22
- # @return [Array<String>]
23
- def render
24
- Vedeu::Terminal.output(parsed)
25
- end
26
-
27
- private
28
-
29
- # @!attribute [r] output
30
- # @return [Array<Array<Vedeu::Char>>]
31
- attr_reader :output
32
-
33
- # @return [String]
34
- def parsed
35
- Vedeu::Compressor.new(output).render
36
- end
37
-
38
- end # Renderers::Terminal
3
+ module Renderers
4
+
5
+ # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
+ # and content suitable for a terminal.
7
+ class Terminal
8
+
9
+ # @param output [Array<Array<Vedeu::Char>>]
10
+ # @return [String]
11
+ def self.render(*output)
12
+ new(*output).render
13
+ end
14
+
15
+ # Returns a new instance of Vedeu::Renderers::Terminal.
16
+ #
17
+ # @param output [Array<Array<Vedeu::Char>>]
18
+ # @return [Vedeu::Renderers::Terminal]
19
+ def initialize(*output)
20
+ @output = output
21
+ end
22
+
23
+ # @return [Array<String>]
24
+ def render
25
+ Vedeu::Terminal.output(parsed)
26
+ end
27
+
28
+ protected
29
+
30
+ # @!attribute [r] output
31
+ # @return [Array<Array<Vedeu::Char>>]
32
+ attr_reader :output
33
+
34
+ private
35
+
36
+ # @return [String]
37
+ def parsed
38
+ Vedeu::Compressor.new(output).render
39
+ end
40
+
41
+ end # Terminal
42
+
43
+ end # Renderers
39
44
 
40
45
  end # Vedeu
@@ -1,40 +1,45 @@
1
1
  module Vedeu
2
2
 
3
- # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
4
- # and content.
5
- #
6
- class Renderers::Text
7
-
8
- # @param output [Array<Array<Vedeu::Char>>]
9
- # @return [String]
10
- def self.render(*output)
11
- new(*output).render
12
- end
13
-
14
- # Returns a new instance of Vedeu::Renderers::Text.
15
- #
16
- # @param output [Array<Array<Vedeu::Char>>]
17
- # @return [Vedeu::Renderers::Text]
18
- def initialize(*output)
19
- @output = output
20
- end
21
-
22
- # @return [String]
23
- def render
24
- parsed
25
- end
26
-
27
- private
28
-
29
- # @!attribute [r] output
30
- # @return [Array<Array<Vedeu::Char>>]
31
- attr_reader :output
32
-
33
- # @return [String]
34
- def parsed
35
- Vedeu::Compressor.new(output).render
36
- end
37
-
38
- end # Renderers::Text
3
+ module Renderers
4
+
5
+ # Converts a grid of {Vedeu::Char} objects into a stream of escape sequences
6
+ # and content.
7
+ class Text
8
+
9
+ # @param output [Array<Array<Vedeu::Char>>]
10
+ # @return [String]
11
+ def self.render(*output)
12
+ new(*output).render
13
+ end
14
+
15
+ # Returns a new instance of Vedeu::Renderers::Text.
16
+ #
17
+ # @param output [Array<Array<Vedeu::Char>>]
18
+ # @return [Vedeu::Renderers::Text]
19
+ def initialize(*output)
20
+ @output = output
21
+ end
22
+
23
+ # @return [String]
24
+ def render
25
+ parsed
26
+ end
27
+
28
+ protected
29
+
30
+ # @!attribute [r] output
31
+ # @return [Array<Array<Vedeu::Char>>]
32
+ attr_reader :output
33
+
34
+ private
35
+
36
+ # @return [String]
37
+ def parsed
38
+ Vedeu::Compressor.new(output).render
39
+ end
40
+
41
+ end # Text
42
+
43
+ end # Renderers
39
44
 
40
45
  end # Vedeu
@@ -1,5 +1,3 @@
1
- require 'vedeu/support/common'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Converts the style value or value collection into a terminal escape
@@ -11,7 +9,6 @@ module Vedeu
11
9
  # Styles are applied as encountered.
12
10
  #
13
11
  # @see Vedeu::Esc
14
- #
15
12
  class Style
16
13
 
17
14
  include Vedeu::Common
@@ -1,7 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # Present a string (or object responding to `to_s`).
4
- #
5
4
  class Text
6
5
 
7
6
  # @see Vedeu::DSL::Text#text
@@ -55,7 +54,7 @@ module Vedeu
55
54
  model.add(content)
56
55
  end
57
56
 
58
- private
57
+ protected
59
58
 
60
59
  # @!attribute [r] value
61
60
  # @return [String]
@@ -65,6 +64,8 @@ module Vedeu
65
64
  # @return [Hash]
66
65
  attr_reader :options
67
66
 
67
+ private
68
+
68
69
  # @return [Symbol] One of :align, :centre, :center, :left, :right, :text
69
70
  def anchor
70
71
  options[:anchor]