vedeu 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +2 -1
- data/bin/vedeu +1 -4
- data/lib/vedeu/all.rb +8 -12
- data/lib/vedeu/bindings/drb.rb +2 -2
- data/lib/vedeu/bindings/system.rb +11 -7
- data/lib/vedeu/{output/virtual_terminal.rb → buffers/virtual_buffer.rb} +15 -8
- data/lib/vedeu/{output/virtual_buffer.rb → buffers/virtual_buffers.rb} +4 -4
- data/lib/vedeu/cursor/cursor.rb +2 -6
- data/lib/vedeu/cursor/reposition.rb +11 -6
- data/lib/vedeu/esc/esc.rb +4 -0
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/output/output.rb +1 -1
- data/lib/vedeu/plugins.rb +7 -3
- data/lib/vedeu/plugins/plugin.rb +4 -4
- data/lib/vedeu/refresh/refresh.rb +31 -0
- data/lib/vedeu/refresh/refresh_buffer.rb +53 -0
- data/lib/vedeu/{cursor → refresh}/refresh_cursor.rb +4 -4
- data/lib/vedeu/refresh/refresh_group.rb +59 -0
- data/lib/vedeu/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/{output/virtual_terminal_test.rb → buffers/virtual_buffer_test.rb} +16 -12
- data/test/lib/vedeu/{output/virtual_buffer_test.rb → buffers/virtual_buffers_test.rb} +3 -3
- data/test/lib/vedeu/cursor/cursors_test.rb +2 -0
- data/test/lib/vedeu/distributed/client_test.rb +13 -9
- data/test/lib/vedeu/distributed/server_test.rb +5 -0
- data/test/lib/vedeu/distributed/subprocess_test.rb +12 -1
- data/test/lib/vedeu/models/views/view_test.rb +41 -0
- data/test/lib/vedeu/output/output_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +15 -16
- data/test/lib/vedeu/plugins_test.rb +7 -0
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +50 -0
- data/test/lib/vedeu/{cursor → refresh}/refresh_cursor_test.rb +8 -6
- data/test/lib/vedeu/{output → refresh}/refresh_group_test.rb +4 -2
- data/test/lib/vedeu/refresh/refresh_test.rb +44 -0
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +3 -3
- metadata +24 -55
- data/lib/vedeu/cli/generator/all.rb +0 -9
- data/lib/vedeu/cli/generator/application.rb +0 -133
- data/lib/vedeu/cli/generator/helpers.rb +0 -139
- data/lib/vedeu/cli/generator/templates/application/.gitignore +0 -1
- data/lib/vedeu/cli/generator/templates/application/.ruby-version +0 -1
- data/lib/vedeu/cli/generator/templates/application/Gemfile +0 -4
- data/lib/vedeu/cli/generator/templates/application/LICENSE.txt +0 -24
- data/lib/vedeu/cli/generator/templates/application/README.md +0 -18
- data/lib/vedeu/cli/generator/templates/application/app/controllers/application_controller.erb +0 -7
- data/lib/vedeu/cli/generator/templates/application/app/controllers/name.erb +0 -22
- data/lib/vedeu/cli/generator/templates/application/app/helpers/application_helper.erb +0 -9
- data/lib/vedeu/cli/generator/templates/application/app/helpers/name.erb +0 -11
- data/lib/vedeu/cli/generator/templates/application/app/models/keymaps/_global_.rb +0 -8
- data/lib/vedeu/cli/generator/templates/application/app/models/keymaps/name.erb +0 -3
- data/lib/vedeu/cli/generator/templates/application/app/views/interfaces/name.erb +0 -67
- data/lib/vedeu/cli/generator/templates/application/app/views/name.erb +0 -36
- data/lib/vedeu/cli/generator/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/cli/generator/templates/application/application.erb +0 -22
- data/lib/vedeu/cli/generator/templates/application/bin/name +0 -9
- data/lib/vedeu/cli/generator/templates/application/config/app_name.erb +0 -1
- data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +0 -33
- data/lib/vedeu/cli/generator/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/view.rb +0 -86
- data/lib/vedeu/cli/main.rb +0 -39
- data/lib/vedeu/output/refresh.rb +0 -69
- data/lib/vedeu/output/refresh_group.rb +0 -41
- data/test/lib/vedeu/cli/generator/application_test.rb +0 -37
- data/test/lib/vedeu/cli/generator/helpers_test.rb +0 -197
- data/test/lib/vedeu/cli/generator/view_test.rb +0 -38
- data/test/lib/vedeu/cli/main_test.rb +0 -59
- data/test/lib/vedeu/output/refresh_test.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd33e8e10532a87dc3e6ea6c7aa2142227e70f7
|
4
|
+
data.tar.gz: 29b39513afa32eac1564900988eb5d28d386a17a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1cd9b457457e795e9779b9d1265b6db9e8669d29f03ab62079250b08ecd65f1091c046351e9ae849f3b7843313828652984e1bc4561eef43e972ec600c0a18
|
7
|
+
data.tar.gz: 679201d647f7663cbe6a3789d2967206232efef7636642150ad53bfbc92ccbd18ad55cf0dcd2e0488edaa454405bec7332b8d003825c35de353edf58223483d5
|
data/Dockerfile
CHANGED
data/bin/vedeu
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rake'
|
4
|
-
|
5
4
|
bundler_message = 'Bundler is required. Please install bundler with ' \
|
6
5
|
"'gem install bundler'"
|
7
6
|
begin
|
8
7
|
require 'bundler'
|
9
|
-
|
10
8
|
rescue LoadError
|
11
9
|
puts bundler_message
|
12
|
-
|
13
10
|
end
|
14
11
|
|
15
12
|
fail bundler_message unless defined?(Bundler)
|
16
13
|
|
17
14
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
18
|
-
# load Gem.bin_path('bundler', 'bundle')
|
19
15
|
|
20
16
|
Bundler.setup
|
21
17
|
|
@@ -23,5 +19,6 @@ gem_dir = File.expand_path('..', File.dirname(__FILE__))
|
|
23
19
|
$LOAD_PATH.unshift(gem_dir) unless $LOAD_PATH.include?(gem_dir)
|
24
20
|
|
25
21
|
require 'vedeu'
|
22
|
+
require 'vedeu_cli'
|
26
23
|
|
27
24
|
Vedeu::CLI::Main.start(ARGV.dup)
|
data/lib/vedeu/all.rb
CHANGED
@@ -58,11 +58,17 @@ require 'vedeu/colours/colour'
|
|
58
58
|
|
59
59
|
require 'vedeu/buffers/buffer'
|
60
60
|
require 'vedeu/buffers/buffers'
|
61
|
+
require 'vedeu/buffers/virtual_buffer'
|
62
|
+
require 'vedeu/buffers/virtual_buffers'
|
63
|
+
|
64
|
+
require 'vedeu/refresh/refresh'
|
65
|
+
require 'vedeu/refresh/refresh_cursor'
|
66
|
+
require 'vedeu/refresh/refresh_buffer'
|
67
|
+
require 'vedeu/refresh/refresh_group'
|
61
68
|
|
62
69
|
require 'vedeu/cursor/cursor'
|
63
70
|
require 'vedeu/cursor/cursors'
|
64
71
|
require 'vedeu/cursor/move'
|
65
|
-
require 'vedeu/cursor/refresh_cursor'
|
66
72
|
require 'vedeu/cursor/reposition'
|
67
73
|
|
68
74
|
require 'vedeu/esc/actions'
|
@@ -109,13 +115,6 @@ require 'vedeu/application/application_controller'
|
|
109
115
|
require 'vedeu/application/application_helper'
|
110
116
|
require 'vedeu/application/application_view'
|
111
117
|
|
112
|
-
require 'vedeu/cli/generator/helpers'
|
113
|
-
require 'vedeu/cli/generator/application'
|
114
|
-
require 'vedeu/cli/generator/view'
|
115
|
-
require 'vedeu/cli/generator/all'
|
116
|
-
|
117
|
-
require 'vedeu/cli/main'
|
118
|
-
|
119
118
|
require 'vedeu/distributed/uri'
|
120
119
|
require 'vedeu/distributed/server'
|
121
120
|
require 'vedeu/distributed/client'
|
@@ -154,13 +153,10 @@ require 'vedeu/output/presentation'
|
|
154
153
|
require 'vedeu/output/compressor'
|
155
154
|
require 'vedeu/output/style'
|
156
155
|
require 'vedeu/output/text'
|
157
|
-
require 'vedeu/output/virtual_buffer'
|
158
156
|
require 'vedeu/output/html_char'
|
159
|
-
|
160
|
-
require 'vedeu/output/refresh'
|
157
|
+
|
161
158
|
require 'vedeu/output/output'
|
162
159
|
require 'vedeu/output/viewport'
|
163
|
-
require 'vedeu/output/virtual_terminal'
|
164
160
|
require 'vedeu/output/wordwrap'
|
165
161
|
|
166
162
|
require 'vedeu/api'
|
data/lib/vedeu/bindings/drb.rb
CHANGED
@@ -51,7 +51,7 @@ module Vedeu
|
|
51
51
|
#
|
52
52
|
# @return [TrueClass]
|
53
53
|
def drb_retrieve_output!
|
54
|
-
Vedeu.bind(:_drb_retrieve_output_) { Vedeu::
|
54
|
+
Vedeu.bind(:_drb_retrieve_output_) { Vedeu::VirtualBuffers.retrieve }
|
55
55
|
end
|
56
56
|
|
57
57
|
# Triggering this event with 'data' will push data into the running
|
@@ -63,7 +63,7 @@ module Vedeu
|
|
63
63
|
# @return [TrueClass]
|
64
64
|
def drb_store_output!
|
65
65
|
Vedeu.bind(:_drb_store_output_) do |data|
|
66
|
-
Vedeu::
|
66
|
+
Vedeu::VirtualBuffers.store(Vedeu::VirtualBuffer.output(data))
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -196,11 +196,13 @@ module Vedeu
|
|
196
196
|
Vedeu.bind(:_mode_switch_) { fail Vedeu::ModeSwitch }
|
197
197
|
end
|
198
198
|
|
199
|
-
#
|
200
|
-
# will refresh all interfaces.
|
199
|
+
# Refreshes all registered interfaces or the named interface.
|
201
200
|
#
|
202
|
-
# @note
|
203
|
-
#
|
201
|
+
# @note
|
202
|
+
# The interfaces will be refreshed in z-index order, meaning that
|
203
|
+
# interfaces with a lower z-index will be drawn first. This means
|
204
|
+
# overlapping interfaces will be drawn as specified.
|
205
|
+
# Hidden interfaces will be still refreshed in memory but not shown.
|
204
206
|
#
|
205
207
|
# @example
|
206
208
|
# Vedeu.trigger(:_refresh_)
|
@@ -209,7 +211,7 @@ module Vedeu
|
|
209
211
|
# @return [TrueClass]
|
210
212
|
def refresh!
|
211
213
|
Vedeu.bind(:_refresh_) do |name|
|
212
|
-
name ? Vedeu::
|
214
|
+
name ? Vedeu::RefreshBuffer.by_name(name) : Vedeu::Refresh.all
|
213
215
|
end
|
214
216
|
end
|
215
217
|
|
@@ -222,7 +224,7 @@ module Vedeu
|
|
222
224
|
# @return [TrueClass]
|
223
225
|
def refresh_cursor!
|
224
226
|
Vedeu.bind(:_refresh_cursor_) do |name|
|
225
|
-
Vedeu::RefreshCursor.
|
227
|
+
Vedeu::RefreshCursor.by_name(name)
|
226
228
|
end
|
227
229
|
end
|
228
230
|
|
@@ -233,7 +235,9 @@ module Vedeu
|
|
233
235
|
#
|
234
236
|
# @return [TrueClass]
|
235
237
|
def refresh_group!
|
236
|
-
Vedeu.bind(:_refresh_group_)
|
238
|
+
Vedeu.bind(:_refresh_group_) do |name|
|
239
|
+
Vedeu::RefreshGroup.by_name(name)
|
240
|
+
end
|
237
241
|
end
|
238
242
|
|
239
243
|
# When triggered will cause Vedeu to trigger the `:_clear_` and
|
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Represents a {Vedeu::Terminal} view as a grid of {Vedeu::Cell} objects.
|
4
4
|
#
|
5
|
-
class
|
5
|
+
class VirtualBuffer
|
6
6
|
|
7
7
|
# @!attribute [rw] renderer
|
8
8
|
# @return [void]
|
@@ -16,13 +16,20 @@ module Vedeu
|
|
16
16
|
# @return [Fixnum]
|
17
17
|
attr_reader :width
|
18
18
|
|
19
|
-
#
|
19
|
+
# @param data [Array<Array<Vedeu::Views::Char>>]
|
20
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
21
|
+
# @see Vedeu::VirtualBuffer#output
|
22
|
+
def self.output(data)
|
23
|
+
new(Vedeu.height, Vedeu.width, Vedeu::Renderers::HTML.new).output(data)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a new instance of Vedeu::VirtualBuffer.
|
20
27
|
#
|
21
28
|
# @param height [Fixnum]
|
22
29
|
# @param width [Fixnum]
|
23
30
|
# @param renderer [Object|Vedeu::Renderers::HTML] An object responding to
|
24
31
|
# .render.
|
25
|
-
# @return [Vedeu::
|
32
|
+
# @return [Vedeu::VirtualBuffer]
|
26
33
|
def initialize(height, width, renderer = Vedeu::Renderers::HTML.new)
|
27
34
|
@height = height
|
28
35
|
@width = width
|
@@ -34,7 +41,7 @@ module Vedeu
|
|
34
41
|
#
|
35
42
|
# @return [Array<Array<Vedeu::Views::Char>>]
|
36
43
|
def cells
|
37
|
-
@cells ||=
|
44
|
+
@cells ||= new_virtual_buffer
|
38
45
|
end
|
39
46
|
|
40
47
|
# Read a single cell from the virtual terminal.
|
@@ -79,7 +86,7 @@ module Vedeu
|
|
79
86
|
#
|
80
87
|
# @return [Array<Array<Vedeu::Views::Char>>]
|
81
88
|
def reset
|
82
|
-
@cells =
|
89
|
+
@cells = new_virtual_buffer
|
83
90
|
end
|
84
91
|
alias_method :clear, :reset
|
85
92
|
|
@@ -113,11 +120,11 @@ module Vedeu
|
|
113
120
|
end
|
114
121
|
|
115
122
|
# @return [Array<Array<Vedeu::Cell>>]
|
116
|
-
# @see {Vedeu::
|
117
|
-
def
|
123
|
+
# @see {Vedeu::VirtualBuffer#cells}
|
124
|
+
def new_virtual_buffer
|
118
125
|
Array.new(height) { Array.new(width) { Vedeu::Cell.new } }
|
119
126
|
end
|
120
127
|
|
121
|
-
end #
|
128
|
+
end # VirtualBuffer
|
122
129
|
|
123
130
|
end # Vedeu
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
# Store and retrieve {Vedeu::
|
3
|
+
# Store and retrieve {Vedeu::VirtualBuffer} objects.
|
4
4
|
#
|
5
|
-
# Each {Vedeu::
|
5
|
+
# Each {Vedeu::VirtualBuffer} object is a copy of the current terminal
|
6
6
|
# including content but not as String objects but {Vedeu::Views::Char}
|
7
7
|
# objects. Using {Vedeu::Views::Char} objects means that we can store the data
|
8
8
|
# used to make up the displayed character, complete with its colour, position
|
@@ -13,7 +13,7 @@ module Vedeu
|
|
13
13
|
# we can display the {Vedeu::Views::Char} in multiple ways (e.g. HTML) or in
|
14
14
|
# multiple formats (e.g. JSON), and render/use that in an appropriate way.
|
15
15
|
#
|
16
|
-
module
|
16
|
+
module VirtualBuffers
|
17
17
|
|
18
18
|
extend self
|
19
19
|
|
@@ -66,6 +66,6 @@ module Vedeu
|
|
66
66
|
[]
|
67
67
|
end
|
68
68
|
|
69
|
-
end #
|
69
|
+
end # VirtualBuffers
|
70
70
|
|
71
71
|
end # Vedeu
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
@@ -164,13 +164,9 @@ module Vedeu
|
|
164
164
|
#
|
165
165
|
# @return [String]
|
166
166
|
def visibility
|
167
|
-
|
168
|
-
Vedeu::Escape.new(position: position, value: Vedeu::Esc.show_cursor)
|
167
|
+
value = visible? ? Vedeu::Esc.show_cursor : Vedeu::Esc.hide_cursor
|
169
168
|
|
170
|
-
|
171
|
-
Vedeu::Escape.new(position: position, value: Vedeu::Esc.hide_cursor)
|
172
|
-
|
173
|
-
end
|
169
|
+
Vedeu::Escape.new(position: position, value: value)
|
174
170
|
end
|
175
171
|
|
176
172
|
end # Cursor
|
@@ -26,17 +26,13 @@ module Vedeu
|
|
26
26
|
|
27
27
|
# @return [Vedeu::Cursor]
|
28
28
|
def to
|
29
|
-
|
30
|
-
y: coordinate.y_position,
|
31
|
-
x: coordinate.x_position,
|
32
|
-
oy: y,
|
33
|
-
ox: x).store
|
29
|
+
build_entity!
|
34
30
|
|
35
31
|
Vedeu.trigger(:_clear_, name)
|
36
32
|
Vedeu.trigger(:_refresh_, name)
|
37
33
|
Vedeu.trigger(:_refresh_cursor_, name)
|
38
34
|
|
39
|
-
|
35
|
+
new_entity
|
40
36
|
end
|
41
37
|
|
42
38
|
protected
|
@@ -59,6 +55,15 @@ module Vedeu
|
|
59
55
|
|
60
56
|
private
|
61
57
|
|
58
|
+
def build_entity!
|
59
|
+
@_entity ||= entity.new(name: name,
|
60
|
+
y: coordinate.y_position,
|
61
|
+
x: coordinate.x_position,
|
62
|
+
oy: y,
|
63
|
+
ox: x).store
|
64
|
+
end
|
65
|
+
alias_method :new_entity, :build_entity!
|
66
|
+
|
62
67
|
# @return [Vedeu::Coordinate]
|
63
68
|
def coordinate
|
64
69
|
@coordinate ||= Vedeu::Coordinate.new(name, y, x)
|
data/lib/vedeu/esc/esc.rb
CHANGED
data/lib/vedeu/output/output.rb
CHANGED
@@ -27,7 +27,7 @@ module Vedeu
|
|
27
27
|
if Vedeu::Configuration.drb?
|
28
28
|
Vedeu.trigger(:_drb_store_output_, output)
|
29
29
|
|
30
|
-
# Vedeu::Renderers::HTML.to_file(Vedeu::
|
30
|
+
# Vedeu::Renderers::HTML.to_file(Vedeu::VirtualBuffers.retrieve)
|
31
31
|
end
|
32
32
|
|
33
33
|
Vedeu.renderers.render(output) if Vedeu.ready?
|
data/lib/vedeu/plugins.rb
CHANGED
@@ -24,7 +24,11 @@ module Vedeu
|
|
24
24
|
# @param plugin [Vedeu::Plugin]
|
25
25
|
# @return [Array<void>]
|
26
26
|
def register(name, plugin = false)
|
27
|
-
|
27
|
+
if plugin && not_loaded?(name)
|
28
|
+
Vedeu.log(type: :debug, message: "Registering plugin: #{name}")
|
29
|
+
|
30
|
+
plugins << plugin
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
# Find all installed plugins and store them.
|
@@ -36,7 +40,7 @@ module Vedeu
|
|
36
40
|
Gem::Specification.each do |gem|
|
37
41
|
next unless gem.name =~ /^#{prefix}/
|
38
42
|
|
39
|
-
plugin_name = gem.name[/^#{prefix}
|
43
|
+
plugin_name = gem.name[/^#{prefix}(.*)/, 1]
|
40
44
|
|
41
45
|
register(plugin_name, Vedeu::Plugin.new(plugin_name, gem))
|
42
46
|
end
|
@@ -73,7 +77,7 @@ module Vedeu
|
|
73
77
|
|
74
78
|
# @return [String]
|
75
79
|
def prefix
|
76
|
-
'
|
80
|
+
'vedeu_'
|
77
81
|
end
|
78
82
|
|
79
83
|
end # Plugins
|
data/lib/vedeu/plugins/plugin.rb
CHANGED
@@ -40,11 +40,11 @@ module Vedeu
|
|
40
40
|
begin
|
41
41
|
require gem_name unless enabled?
|
42
42
|
rescue LoadError => error
|
43
|
-
|
44
|
-
|
43
|
+
fail Vedeu::VedeuError,
|
44
|
+
"Unable to load plugin #{gem_name} due to #{error}."
|
45
45
|
rescue => error
|
46
|
-
|
47
|
-
|
46
|
+
fail Vedeu::VedeuError,
|
47
|
+
"require '#{gem_name}' failed with #{error}."
|
48
48
|
end
|
49
49
|
|
50
50
|
@enabled = true
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# @see Vedeu::Bindings::System#refresh!
|
4
|
+
class Refresh
|
5
|
+
|
6
|
+
# Refresh all registered interfaces.
|
7
|
+
#
|
8
|
+
# @return [Array<Vedeu::Interface>]
|
9
|
+
def self.all
|
10
|
+
new.all
|
11
|
+
end
|
12
|
+
|
13
|
+
# Return a new instance of Vedeu::Refresh.
|
14
|
+
#
|
15
|
+
# @return [Vedeu::Refresh]
|
16
|
+
def initialize; end
|
17
|
+
|
18
|
+
# Refresh all registered interfaces.
|
19
|
+
#
|
20
|
+
# @return [Array<Vedeu::Interface>]
|
21
|
+
def all
|
22
|
+
Vedeu.timer('Refreshing all') do
|
23
|
+
Vedeu.interfaces.zindexed.each do |interface|
|
24
|
+
Vedeu.trigger(:_refresh_, interface.name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end # Refresh
|
30
|
+
|
31
|
+
end # Vedeu
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Refreshes the given named interface.
|
4
|
+
#
|
5
|
+
# @example
|
6
|
+
# Vedeu.trigger(:_refresh_, name)
|
7
|
+
#
|
8
|
+
class RefreshBuffer
|
9
|
+
|
10
|
+
include Vedeu::Common
|
11
|
+
|
12
|
+
# @param name [String] The name of the interface to be refreshed using the
|
13
|
+
# named buffer.
|
14
|
+
# @return [Array|Vedeu::ModelNotFound]
|
15
|
+
def self.by_name(name)
|
16
|
+
new(name).by_name
|
17
|
+
end
|
18
|
+
|
19
|
+
# Return a new instance of Vedeu::RefreshBuffer.
|
20
|
+
#
|
21
|
+
# @param name [String]
|
22
|
+
# @return [Vedeu::RefreshBuffer]
|
23
|
+
def initialize(name)
|
24
|
+
@name = name
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [void]
|
28
|
+
def by_name
|
29
|
+
Vedeu.timer("Refresh Buffer: '#{buffer_name}'") do
|
30
|
+
Vedeu.buffers.by_name(buffer_name).render
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
# # @!attribute [r] name
|
37
|
+
# @return [String]
|
38
|
+
attr_reader :name
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# @raise [Vedeu::MissingRequired] When the name is empty or nil.
|
43
|
+
# @return [String]
|
44
|
+
def buffer_name
|
45
|
+
return name if present?(name)
|
46
|
+
|
47
|
+
fail Vedeu::MissingRequired,
|
48
|
+
'Cannot refresh interface with an empty interface name.'
|
49
|
+
end
|
50
|
+
|
51
|
+
end # RefreshBuffer
|
52
|
+
|
53
|
+
end # Vedeu
|