vedeu 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl.md +54 -0
- data/docs/views.md +25 -25
- data/examples/cursor_app.rb +1 -1
- data/examples/material_colours_app.rb +1 -1
- data/lib/vedeu/all.rb +1 -0
- data/lib/vedeu/bindings.rb +2 -15
- data/lib/vedeu/buffers/buffer.rb +30 -7
- data/lib/vedeu/buffers/display_buffer.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +1 -1
- data/lib/vedeu/cursor/refresh_cursor.rb +4 -0
- data/lib/vedeu/dsl/components/border.rb +6 -1
- data/lib/vedeu/geometry/all.rb +0 -1
- data/lib/vedeu/geometry/area.rb +0 -20
- data/lib/vedeu/geometry/coordinate.rb +0 -50
- data/lib/vedeu/geometry/geometry.rb +1 -5
- data/lib/vedeu/geometry/position.rb +9 -0
- data/lib/vedeu/geometry/position_index.rb +19 -14
- data/lib/vedeu/geometry/position_validator.rb +3 -0
- data/lib/vedeu/models/all.rb +0 -3
- data/lib/vedeu/models/interface.rb +2 -4
- data/lib/vedeu/null/all.rb +5 -0
- data/lib/vedeu/null/border.rb +79 -0
- data/lib/vedeu/null/buffer.rb +44 -0
- data/lib/vedeu/null/generic.rb +52 -0
- data/lib/vedeu/null/geometry.rb +70 -0
- data/lib/vedeu/null/interface.rb +23 -0
- data/lib/vedeu/output/all.rb +0 -1
- data/lib/vedeu/output/border.rb +9 -9
- data/lib/vedeu/output/clear.rb +2 -1
- data/lib/vedeu/output/output.rb +1 -1
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +7 -7
- data/lib/vedeu/output/renderers/escape_sequence.rb +47 -0
- data/lib/vedeu/output/renderers/{file_renderer.rb → file.rb} +11 -6
- data/lib/vedeu/output/renderers/{html_renderer.rb → html.rb} +4 -4
- data/lib/vedeu/output/renderers/{json_renderer.rb → json.rb} +4 -4
- data/lib/vedeu/output/renderers/{null_renderer.rb → null.rb} +2 -2
- data/lib/vedeu/output/renderers/{terminal_renderer.rb → terminal.rb} +4 -4
- data/lib/vedeu/output/renderers/{text_renderer.rb → text.rb} +4 -4
- data/lib/vedeu/output/text.rb +2 -2
- data/lib/vedeu/output/virtual_terminal.rb +2 -2
- data/lib/vedeu/repositories/all.rb +2 -0
- data/lib/vedeu/repositories/repositories/borders.rb +4 -2
- data/lib/vedeu/repositories/repositories/buffers.rb +11 -9
- data/lib/vedeu/repositories/repositories/cursors.rb +2 -0
- data/lib/vedeu/repositories/repositories/events_repository.rb +2 -0
- data/lib/vedeu/repositories/repositories/geometries.rb +4 -2
- data/lib/vedeu/repositories/repositories/groups.rb +2 -0
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +4 -2
- data/lib/vedeu/repositories/repositories/keymaps.rb +2 -0
- data/lib/vedeu/repositories/repositories/menus.rb +2 -0
- data/test/lib/vedeu/cursor/cursor_test.rb +1 -1
- data/test/lib/vedeu/cursor/move_test.rb +21 -33
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +16 -1
- data/test/lib/vedeu/distributed/test_application_test.rb +1 -1
- data/test/lib/vedeu/dsl/components/border_test.rb +1 -1
- data/test/lib/vedeu/dsl/components/geometry_test.rb +5 -5
- data/test/lib/vedeu/dsl/components/menu_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +1 -1
- data/test/lib/vedeu/dsl/group_test.rb +1 -1
- data/test/lib/vedeu/dsl/interface_test.rb +1 -1
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/events/event_test.rb +8 -8
- data/test/lib/vedeu/events/trigger_test.rb +1 -1
- data/test/lib/vedeu/geometry/area_test.rb +4 -36
- data/test/lib/vedeu/geometry/canvas_test.rb +2 -2
- data/test/lib/vedeu/geometry/coordinate_test.rb +0 -56
- data/test/lib/vedeu/geometry/dimension_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +1 -1
- data/test/lib/vedeu/geometry/grid_test.rb +1 -1
- data/test/lib/vedeu/geometry/position_index_test.rb +21 -23
- data/test/lib/vedeu/geometry/position_validator_test.rb +121 -3
- data/test/lib/vedeu/input/input_test.rb +1 -1
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/input/keymap_test.rb +1 -1
- data/test/lib/vedeu/models/interface_test.rb +14 -0
- data/test/lib/vedeu/null/border_test.rb +76 -0
- data/test/lib/vedeu/null/generic_test.rb +69 -0
- data/test/lib/vedeu/null/geometry_test.rb +63 -0
- data/test/lib/vedeu/null/interface_test.rb +13 -0
- data/test/lib/vedeu/output/clear_test.rb +1 -1
- data/test/lib/vedeu/output/compressor_test.rb +1 -1
- data/test/lib/vedeu/output/html_char_test.rb +1 -1
- data/test/lib/vedeu/output/output_test.rb +1 -1
- data/test/lib/vedeu/output/refresh_test.rb +17 -5
- data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +4 -4
- data/test/lib/vedeu/output/renderers/{file_renderer_test.rb → file_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{html_renderer_test.rb → html_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{json_renderer_test.rb → json_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{null_renderer_test.rb → null_test.rb} +3 -3
- data/test/lib/vedeu/output/renderers/{terminal_renderer_test.rb → terminal_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{text_renderer_test.rb → text_test.rb} +4 -4
- data/test/lib/vedeu/output/style_test.rb +1 -1
- data/test/lib/vedeu/output/translator_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +1 -1
- data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -3
- data/test/lib/vedeu/repositories/collection_test.rb +2 -2
- data/test/lib/vedeu/repositories/collections/chars_test.rb +1 -1
- data/test/lib/vedeu/repositories/collections/events_test.rb +1 -1
- data/test/lib/vedeu/repositories/collections/interfaces_test.rb +1 -1
- data/test/lib/vedeu/repositories/collections/keys_test.rb +1 -1
- data/test/lib/vedeu/repositories/collections/lines_test.rb +1 -1
- data/test/lib/vedeu/repositories/collections/streams_test.rb +1 -1
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +1 -1
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +11 -23
- data/test/lib/vedeu/repositories/repositories/colours_test.rb +1 -1
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +1 -1
- data/test/lib/vedeu/storage/associative_store_test.rb +1 -1
- data/test/lib/vedeu/storage/conveyor_store_test.rb +1 -1
- data/test/lib/vedeu/storage/fifo_store_test.rb +1 -1
- data/test/lib/vedeu/support/template_test.rb +1 -1
- data/test/lib/vedeu/support/trace_test.rb +1 -1
- data/test/lib/vedeu/support/visibility_test.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +36 -33
- data/lib/vedeu/geometry/null_geometry.rb +0 -70
- data/lib/vedeu/models/null.rb +0 -48
- data/lib/vedeu/models/null_interface.rb +0 -20
- data/lib/vedeu/output/null_border.rb +0 -75
- data/lib/vedeu/output/renderers/escape_sequence_renderer.rb +0 -43
- data/test/lib/vedeu/geometry/null_geometry_test.rb +0 -59
- data/test/lib/vedeu/models/null_interface_test.rb +0 -9
- data/test/lib/vedeu/models/null_test.rb +0 -66
- 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
|
data/lib/vedeu/output/all.rb
CHANGED
data/lib/vedeu/output/border.rb
CHANGED
@@ -174,7 +174,7 @@ module Vedeu
|
|
174
174
|
|
175
175
|
# @return [String]
|
176
176
|
def to_s
|
177
|
-
Vedeu::
|
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
|
368
|
-
when :bottom_horizontal then
|
369
|
-
when :left_vertical then
|
370
|
-
when :right_vertical then
|
371
|
-
when :bottom_left then
|
372
|
-
when :bottom_right then
|
373
|
-
when :top_left then
|
374
|
-
when :top_right then
|
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
|
|
data/lib/vedeu/output/clear.rb
CHANGED
@@ -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,
|
108
|
+
@colour ||= Vedeu::Colour.new(background: :default,
|
109
|
+
foreground: :default)
|
109
110
|
|
110
111
|
else
|
111
112
|
colour
|
data/lib/vedeu/output/output.rb
CHANGED
@@ -30,7 +30,7 @@ module Vedeu
|
|
30
30
|
if Vedeu::Configuration.drb?
|
31
31
|
Vedeu.trigger(:_drb_store_output_, content)
|
32
32
|
|
33
|
-
Vedeu::
|
33
|
+
Vedeu::Renderers::HTML.to_file(Vedeu::VirtualBuffer.retrieve)
|
34
34
|
end
|
35
35
|
|
36
36
|
Vedeu.renderers.render(content)
|
data/lib/vedeu/output/refresh.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
6
|
-
require_relative '
|
7
|
-
require_relative '
|
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
|
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::
|
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::
|
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(
|
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 #
|
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
|
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::
|
20
|
+
# Returns a new instance of Vedeu::Renderers::HTML.
|
21
21
|
#
|
22
22
|
# @param output [Array<Array<Vedeu::Char>>]
|
23
|
-
# @return [Vedeu::
|
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 #
|
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
|
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::
|
20
|
+
# Returns a new instance of Vedeu::Renderers::JSON.
|
21
21
|
#
|
22
22
|
# @param output [Array<Array<Vedeu::Char>>]
|
23
|
-
# @return [Vedeu::
|
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 #
|
50
|
+
end # Renderers::JSON
|
51
51
|
|
52
52
|
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
|
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::
|
14
|
+
# Returns a new instance of Vedeu::Renderers::Terminal.
|
15
15
|
#
|
16
16
|
# @param output [Array<Array<Vedeu::Char>>]
|
17
|
-
# @return [Vedeu::
|
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 #
|
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
|
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::
|
14
|
+
# Returns a new instance of Vedeu::Renderers::Text.
|
15
15
|
#
|
16
16
|
# @param output [Array<Array<Vedeu::Char>>]
|
17
|
-
# @return [Vedeu::
|
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 #
|
38
|
+
end # Renderers::Text
|
39
39
|
|
40
40
|
end # Vedeu
|
data/lib/vedeu/output/text.rb
CHANGED
@@ -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|
|
23
|
+
# @param renderer [Object|Renderers::HTML] An object responding to .render.
|
24
24
|
# @return [Vedeu::VirtualTerminal]
|
25
|
-
def initialize(height, width, renderer = Vedeu::
|
25
|
+
def initialize(height, width, renderer = Vedeu::Renderers::HTML)
|
26
26
|
@height = height
|
27
27
|
@width = width
|
28
28
|
@renderer = renderer
|
@@ -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::
|
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::
|
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
|
23
|
-
# @return [
|
24
|
-
def
|
25
|
-
|
26
|
-
|
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
|
-
|
29
|
-
# @return [void]
|
30
|
-
def render(name)
|
31
|
-
find!(name).render
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
end # Buffers
|
@@ -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::
|
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::
|
32
|
+
Vedeu::Null::Geometry.new(name)
|
31
33
|
|
32
34
|
end
|
33
35
|
end
|