vedeu 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +2 -0
  3. data/docs/events.md +0 -4
  4. data/examples/cursor_app/cursor_app.rb +56 -44
  5. data/lib/vedeu/api/api.rb +4 -6
  6. data/lib/vedeu/api/composition.rb +3 -7
  7. data/lib/vedeu/api/interface.rb +2 -3
  8. data/lib/vedeu/api/menu.rb +5 -3
  9. data/lib/vedeu/api/stream.rb +34 -0
  10. data/lib/vedeu/application.rb +4 -7
  11. data/lib/vedeu/configuration/api.rb +0 -5
  12. data/lib/vedeu/configuration/cli.rb +0 -1
  13. data/lib/vedeu/configuration/configuration.rb +0 -12
  14. data/lib/vedeu/input/input.rb +0 -3
  15. data/lib/vedeu/launcher.rb +0 -1
  16. data/lib/vedeu/models/{attributes/background.rb → background.rb} +0 -4
  17. data/lib/vedeu/models/char.rb +43 -0
  18. data/lib/vedeu/models/colour.rb +0 -1
  19. data/lib/vedeu/models/composition.rb +4 -3
  20. data/lib/vedeu/models/cursor.rb +70 -146
  21. data/lib/vedeu/models/{attributes/foreground.rb → foreground.rb} +0 -4
  22. data/lib/vedeu/models/geometry.rb +19 -20
  23. data/lib/vedeu/models/interface.rb +36 -5
  24. data/lib/vedeu/models/keymap.rb +7 -4
  25. data/lib/vedeu/models/line.rb +31 -11
  26. data/lib/vedeu/models/offset.rb +84 -0
  27. data/lib/vedeu/models/stream.rb +37 -13
  28. data/lib/vedeu/models/style.rb +0 -1
  29. data/lib/vedeu/output/area.rb +284 -0
  30. data/lib/vedeu/output/clear.rb +2 -4
  31. data/lib/vedeu/output/compositor.rb +0 -4
  32. data/lib/vedeu/output/refresh.rb +1 -2
  33. data/lib/vedeu/output/render.rb +12 -163
  34. data/lib/vedeu/output/view.rb +0 -2
  35. data/lib/vedeu/output/viewport.rb +132 -0
  36. data/lib/vedeu/repositories/buffers.rb +11 -22
  37. data/lib/vedeu/repositories/cursors.rb +20 -47
  38. data/lib/vedeu/repositories/events.rb +2 -1
  39. data/lib/vedeu/repositories/focus.rb +16 -16
  40. data/lib/vedeu/repositories/groups.rb +1 -4
  41. data/lib/vedeu/repositories/interfaces.rb +10 -3
  42. data/lib/vedeu/repositories/keymaps.rb +0 -3
  43. data/lib/vedeu/repositories/menus.rb +0 -2
  44. data/lib/vedeu/repositories/offsets.rb +47 -0
  45. data/lib/vedeu/{models/attributes → support}/coercions.rb +0 -0
  46. data/lib/vedeu/{models/attributes → support}/colour_translator.rb +0 -16
  47. data/lib/vedeu/support/esc.rb +0 -22
  48. data/lib/vedeu/support/event.rb +1 -17
  49. data/lib/vedeu/support/exceptions.rb +0 -3
  50. data/lib/vedeu/support/grid.rb +0 -3
  51. data/lib/vedeu/support/log.rb +13 -14
  52. data/lib/vedeu/support/move.rb +50 -0
  53. data/lib/vedeu/support/position.rb +17 -9
  54. data/lib/vedeu/{models/attributes → support}/presentation.rb +1 -4
  55. data/lib/vedeu/support/registrar.rb +2 -2
  56. data/lib/vedeu/support/repository.rb +23 -2
  57. data/lib/vedeu/support/terminal.rb +0 -2
  58. data/lib/vedeu/support/trace.rb +0 -11
  59. data/lib/vedeu.rb +11 -5
  60. data/test/lib/vedeu/api/api_test.rb +14 -5
  61. data/test/lib/vedeu/api/composition_test.rb +9 -26
  62. data/test/lib/vedeu/api/keymap_test.rb +1 -1
  63. data/test/lib/vedeu/api/menu_test.rb +6 -0
  64. data/test/lib/vedeu/api/stream_test.rb +32 -0
  65. data/test/lib/vedeu/models/{attributes/background_test.rb → background_test.rb} +0 -0
  66. data/test/lib/vedeu/models/char_test.rb +46 -0
  67. data/test/lib/vedeu/models/composition_test.rb +7 -0
  68. data/test/lib/vedeu/models/cursor_test.rb +63 -80
  69. data/test/lib/vedeu/models/{attributes/foreground_test.rb → foreground_test.rb} +0 -0
  70. data/test/lib/vedeu/models/geometry_test.rb +8 -10
  71. data/test/lib/vedeu/models/interface_test.rb +26 -21
  72. data/test/lib/vedeu/models/keymap_test.rb +6 -0
  73. data/test/lib/vedeu/models/line_test.rb +82 -3
  74. data/test/lib/vedeu/models/offset_test.rb +121 -0
  75. data/test/lib/vedeu/models/stream_test.rb +107 -8
  76. data/test/lib/vedeu/output/area_test.rb +242 -0
  77. data/test/lib/vedeu/output/compositor_test.rb +12 -3
  78. data/test/lib/vedeu/output/render_test.rb +34 -39
  79. data/test/lib/vedeu/output/viewport_test.rb +36 -0
  80. data/test/lib/vedeu/repositories/cursors_test.rb +32 -9
  81. data/test/lib/vedeu/repositories/focus_test.rb +8 -0
  82. data/test/lib/vedeu/repositories/offsets_test.rb +32 -0
  83. data/test/lib/vedeu/{models/attributes → support}/coercions_test.rb +0 -0
  84. data/test/lib/vedeu/{models/attributes → support}/colour_translator_test.rb +0 -0
  85. data/test/lib/vedeu/support/move_test.rb +35 -0
  86. data/test/lib/vedeu/{models/attributes → support}/presentation_test.rb +0 -0
  87. data/test/lib/vedeu/support/registrar_test.rb +6 -0
  88. data/test/lib/vedeu_test.rb +5 -0
  89. data/vedeu.gemspec +1 -1
  90. metadata +37 -17
@@ -7,26 +7,26 @@ module Vedeu
7
7
  # @api private
8
8
  class Render
9
9
 
10
+ extend Forwardable
11
+
12
+ def_delegators :interface, :viewport
13
+
10
14
  # Create a new instance of Render with the provided {Vedeu::Interface} and
11
15
  # then convert the interface into a single string of content and escape
12
16
  # sequences.
13
17
  #
14
- # @api private
15
18
  # @param interface [Interface]
16
- # @param options [Hash]
17
19
  # @return [String]
18
- def self.call(interface, options = {})
19
- new(interface, options).render
20
+ def self.call(interface)
21
+ new(interface).render
20
22
  end
21
23
 
22
24
  # Return a new instance of Render.
23
25
  #
24
26
  # @param interface [Interface]
25
- # @param options [Hash]
26
27
  # @return [Render]
27
- def initialize(interface, options = {})
28
+ def initialize(interface)
28
29
  @interface = interface
29
- @options = options
30
30
  end
31
31
 
32
32
  # Produces a single string which contains all content and escape sequences
@@ -34,13 +34,15 @@ module Vedeu
34
34
  #
35
35
  # @return [String]
36
36
  def render
37
+ out = [ Clear.call(interface) ]
38
+
37
39
  Vedeu.log("Rendering view: '#{interface.name}'")
38
40
 
39
- out = [ Clear.call(interface) ]
40
- processed_lines.each_with_index do |line, index|
41
+ viewport.each_with_index do |line, index|
41
42
  out << interface.origin(index)
42
- out << line.to_s
43
+ out << line.join
43
44
  end
45
+ out << interface.cursor.to_s if interface.in_focus?
44
46
  out.join
45
47
  end
46
48
 
@@ -48,159 +50,6 @@ module Vedeu
48
50
 
49
51
  attr_reader :interface
50
52
 
51
- # The client application may have created a line that us too long for the
52
- # interface. This code tries to truncate streams whilst preserving styles
53
- # and colours. To achieve this, it successively checks each stream length
54
- # against remaining line length and truncates the stream data if it
55
- # exceeds the line length. Further stream data that does not fit is
56
- # discarded.
57
- #
58
- # @api private
59
- # @return [Array]
60
- def processed_lines
61
- return [] unless visible_lines.any? { |line| line.streams.any? }
62
-
63
- visible_lines.map do |line|
64
- if exceeds_width?(line)
65
- line_length = 0
66
- new_streams = []
67
-
68
- new_streams = line.streams.map do |stream|
69
- next if stream.content.empty?
70
-
71
- if (line_length += stream.content.size) >= width
72
- remainder = width - line_length
73
- truncated = truncate(stream.content, remainder)
74
-
75
- build_stream(line, stream, truncated)
76
-
77
- else
78
- stream
79
-
80
- end
81
- end
82
-
83
- build_line(line, new_streams)
84
-
85
- else
86
- line
87
-
88
- end
89
- end
90
- end
91
-
92
- # Builds a new Stream object with the newly truncated text and previous
93
- # attributes.
94
- #
95
- # @api private
96
- # @param line [Line]
97
- # @param stream [Stream]
98
- # @param content [String]
99
- # @return [Stream]
100
- def build_stream(line, stream, content)
101
- attributes = stream.view_attributes.merge!({
102
- parent: line.view_attributes,
103
- text: content,
104
- })
105
-
106
- Stream.new(attributes)
107
- end
108
-
109
- # Builds a new Line object with the new streams and previous attributes.
110
- #
111
- # @api private
112
- # @param line [Line]
113
- # @param streams [Array]
114
- # @return [Line]
115
- def build_line(line, streams)
116
- attributes = line.view_attributes.merge!({
117
- parent: interface.view_attributes,
118
- streams: streams,
119
- })
120
-
121
- Line.new(attributes)
122
- end
123
-
124
- # Converts all streams within a line into a single line of text to then
125
- # check that this line (without formatting, as that is not visible) exceeds
126
- # the width of the interface.
127
- #
128
- # @api private
129
- # @param line [Line]
130
- # @return [Boolean]
131
- def exceeds_width?(line)
132
- line.streams.map(&:content).join.size > width
133
- end
134
-
135
- # Truncates the provided string.
136
- #
137
- # @api private
138
- # @param string [String] The string to be truncated.
139
- # @param value [Fixnum] The total length of the string after truncation.
140
- # @return [String]
141
- def truncate(string, value)
142
- string.chomp.slice(0...value)
143
- end
144
-
145
- # Provides the collection of visible lines associated with the interface.
146
- # If the option `:top` was set, we will start at that line. Any lines
147
- # outside of the height will not be rendered.
148
- #
149
- # @api private
150
- # @return [Array]
151
- def visible_lines
152
- lines[top..height]
153
- end
154
-
155
- # Provides the collection of lines associated with the interface.
156
- #
157
- # @api private
158
- # @return [Array]
159
- def lines
160
- interface.lines
161
- end
162
-
163
- # Provides the currently available height of the interface.
164
- #
165
- # @note The height is reported to be one less line than actual because
166
- # terminal coordinates count from 1, not 0.
167
- #
168
- # @api private
169
- # @return [Fixnum]
170
- def height
171
- interface.viewport_height - 1
172
- end
173
-
174
- # Provides the currently available width of the interface.
175
- #
176
- # @api private
177
- # @return [Fixnum]
178
- def width
179
- interface.viewport_width
180
- end
181
-
182
- # The current top line.
183
- #
184
- # @api private
185
- # @return [Fixnum]
186
- def top
187
- options[:top]
188
- end
189
-
190
- # @api private
191
- # @return [Hash]
192
- def options
193
- @_options ||= defaults.merge!(@options)
194
- end
195
-
196
- # @api private
197
- # @return [Hash]
198
- def defaults
199
- {
200
- top: 0
201
- }
202
- end
203
-
204
53
  end # Render
205
54
 
206
55
  end # Vedeu
@@ -46,7 +46,6 @@ module Vedeu
46
46
 
47
47
  # Create a new Composition object with the attributes.
48
48
  #
49
- # @api private
50
49
  # @return [Composition]
51
50
  def composition
52
51
  @_composition ||= Composition.new(attributes)
@@ -55,7 +54,6 @@ module Vedeu
55
54
  # Calls the #render method of the subclass, hopefully receives attributes
56
55
  # suitable to create one or more views.
57
56
  #
58
- # @api private
59
57
  # @return []
60
58
  def attributes
61
59
  render
@@ -0,0 +1,132 @@
1
+ module Vedeu
2
+
3
+ # A Viewport is the visible part of the content within an interface.
4
+ #
5
+ # When a buffer has more lines than the defined height, or more columns than
6
+ # the defined width of the interface, the Viewport class provides 'scrolling'
7
+ # via the cursor's position.
8
+ #
9
+ class Viewport
10
+
11
+ extend Forwardable
12
+
13
+ def_delegators :interface, :content, :height, :offset, :width
14
+
15
+ # @see Viewport#show
16
+ def self.show(interface)
17
+ new(interface).show
18
+ end
19
+
20
+ # Returns an instance of Viewport.
21
+ #
22
+ # @param interface [Interface] An instance of interface.
23
+ # @return [Viewport]
24
+ def initialize(interface)
25
+ @interface = interface
26
+ @top = 0
27
+ @left = 0
28
+ end
29
+
30
+ # Returns the visible content for the interface.
31
+ #
32
+ # @return [Array]
33
+ def show
34
+ line_adjustment
35
+ column_adjustment
36
+
37
+ return [] unless content?
38
+
39
+ content[lines].map { |line| line.chars[columns] }.compact
40
+ end
41
+
42
+ private
43
+
44
+ attr_reader :interface
45
+
46
+ # @return [Fixnum]
47
+ def line_adjustment
48
+ if offset.y < lines.min
49
+ set_top(offset.y)
50
+
51
+ elsif offset.y > lines.max
52
+ set_top(offset.y - (lines.max - lines.min))
53
+
54
+ else
55
+ # @top does not need adjusting
56
+
57
+ end
58
+ end
59
+
60
+ # @return [Fixnum]
61
+ def column_adjustment
62
+ if offset.x < columns.min
63
+ set_left(offset.x)
64
+
65
+ elsif offset.x > columns.max
66
+ set_left(offset.x - (columns.max - columns.min))
67
+
68
+ else
69
+ # @left does not need adjusting
70
+
71
+ end
72
+ end
73
+
74
+ # @param value [Fixnum]
75
+ # @return [Fixnum]
76
+ def set_top(value)
77
+ @top = [[value, (content_height - height)].min, 0].max
78
+ end
79
+
80
+ # @param value [Fixnum]
81
+ # @return [Fixnum]
82
+ def set_left(value)
83
+ @left = [value, 0].max
84
+ end
85
+
86
+ # @return [Range]
87
+ def lines
88
+ @top..(@top + height - 1)
89
+ end
90
+
91
+ # @return [Range]
92
+ def columns
93
+ @left..(@left + width - 1)
94
+ end
95
+
96
+ # Returns the height of the content, or when no content, the visible height
97
+ # of the interface.
98
+ #
99
+ # @return [Fixnum]
100
+ def content_height
101
+ return height unless content?
102
+
103
+ [content.size, height].max
104
+ end
105
+
106
+ # Returns the width of the content, or when no content, the visible width of
107
+ # the interface.
108
+ #
109
+ # @return [Fixnum]
110
+ def content_width
111
+ return width unless content?
112
+
113
+ [content_maximum_line_length, width].max
114
+ end
115
+
116
+ # Returns the character length of the longest line for this interface.
117
+ #
118
+ # @return [Fixnum]
119
+ def content_maximum_line_length
120
+ content.map { |line| line.size }.max
121
+ end
122
+
123
+ # Return a boolean indicating whether this interface currently has content.
124
+ #
125
+ # @return [Boolean]
126
+ def content?
127
+ content.any?
128
+ end
129
+
130
+ end # Viewport
131
+
132
+ end # Vedeu
@@ -49,31 +49,26 @@ module Vedeu
49
49
  # and we should return nothing.
50
50
  #
51
51
  # @param name [String]
52
- # @return [Hash]
52
+ # @return [Hash|NilClass]
53
53
  def latest(name)
54
- if new_content?(name)
55
- swap_buffers(name)
56
- front_buffer(name)
57
-
58
- elsif old_content?(name)
59
- front_buffer(name)
60
-
61
- else
62
- nil
54
+ swap_buffers(name) if new_content?(name)
63
55
 
64
- end
56
+ front_buffer(name)
65
57
  end
66
58
 
67
59
  private
68
60
 
69
- # Swap the named back buffer into the front buffer of the same name.
61
+ # Swap the named back buffer into the front buffer of the same name. This is
62
+ # called when the back buffer has new content (perhaps as part of a
63
+ # refresh). It also resets the offsets (i.e. scroll position)
70
64
  #
71
- # @api private
72
65
  # @param name [String]
73
66
  # @return [Hash]
74
67
  def swap_buffers(name)
75
68
  buffer = find(name)
76
69
 
70
+ Offsets.update({ name: name })
71
+
77
72
  storage.store(name, {
78
73
  front_buffer: buffer[:back_buffer],
79
74
  back_buffer: nil,
@@ -82,7 +77,6 @@ module Vedeu
82
77
 
83
78
  # Return a boolean indicating whether the named back buffer has new content.
84
79
  #
85
- # @api private
86
80
  # @param name [String]
87
81
  # @return [Boolean]
88
82
  def new_content?(name)
@@ -91,16 +85,14 @@ module Vedeu
91
85
 
92
86
  # Return a boolean indicating whether the named front buffer has content.
93
87
  #
94
- # @api private
95
88
  # @param name [String]
96
89
  # @return [Boolean]
97
- def old_content?(name)
98
- defined_value?(front_buffer(name))
99
- end
90
+ # def old_content?(name)
91
+ # defined_value?(front_buffer(name))
92
+ # end
100
93
 
101
94
  # Return the named back buffer.
102
95
  #
103
- # @api private
104
96
  # @param name [String]
105
97
  # @return [Hash|Nil]
106
98
  def back_buffer(name)
@@ -109,14 +101,12 @@ module Vedeu
109
101
 
110
102
  # Return the named front buffer.
111
103
  #
112
- # @api private
113
104
  # @param name [String]
114
105
  # @return [Hash|Nil]
115
106
  def front_buffer(name)
116
107
  find(name)[:front_buffer]
117
108
  end
118
109
 
119
- # @api private
120
110
  # @return [Hash]
121
111
  def in_memory
122
112
  Hash.new do |hash, interface_name|
@@ -127,7 +117,6 @@ module Vedeu
127
117
  end
128
118
  end
129
119
 
130
- # @api private
131
120
  # @param name [String]
132
121
  # @raise [BufferNotFound] When the entity cannot be found with this name.
133
122
  # @return [BufferNotFound]
@@ -10,15 +10,10 @@ module Vedeu
10
10
  include Repository
11
11
  extend self
12
12
 
13
- # System events which when called will update the cursor position or
14
- # visibility accordingly for the interface in focus.
15
- Vedeu.event(:_cursor_up_) { Cursors.use(:move_up) }
16
- Vedeu.event(:_cursor_right_) { Cursors.use(:move_right) }
17
- Vedeu.event(:_cursor_down_) { Cursors.use(:move_down) }
18
- Vedeu.event(:_cursor_left_) { Cursors.use(:move_left) }
19
- Vedeu.event(:_cursor_hide_) { Cursors.use(:hide) }
20
- Vedeu.event(:_cursor_show_) { Cursors.use(:show) }
21
- Vedeu.event(:_cursor_refresh_) { Cursors.use(:refresh) }
13
+ # System events which when called will update the cursor visibility
14
+ # accordingly for the interface in focus.
15
+ Vedeu.event(:_cursor_hide_) { Cursors.hide }
16
+ Vedeu.event(:_cursor_show_) { Cursors.show }
22
17
 
23
18
  # Adds an interface to the cursors repository.
24
19
  #
@@ -27,50 +22,36 @@ module Vedeu
27
22
  def add(attributes)
28
23
  validate_attributes!(attributes)
29
24
 
30
- Vedeu.log("Registering cursor: '#{attributes[:name]}'")
25
+ Vedeu.log("#{action(__callee__)} cursor: '#{attributes[:name]}'")
31
26
 
32
- storage.store(attributes[:name], {
33
- name: attributes[:name],
34
- x: 1,
35
- y: 1,
36
- state: :show
37
- })
27
+ storage.store(attributes[:name], Cursor.new(attributes))
38
28
  end
29
+ alias_method :update, :add
39
30
 
40
- # Saves the attributes in the repository for future use.
31
+ # Make the cursor of this interface invisible.
41
32
  #
42
- # @param attributes [Hash]
43
- # @return [Hash]
44
- def update(attributes)
45
- return false unless defined_value?(attributes[:name])
46
-
47
- Vedeu.log("Updating cursor: '#{attributes[:name]}'")
48
-
49
- storage.store(attributes[:name], attributes)
33
+ # @return [Cursor]
34
+ def hide
35
+ find_or_create(Focus.current).hide
50
36
  end
51
37
 
52
- # Perform an action (moving, showing or hiding) and save the new cursor
53
- # state.
38
+ # Make the cursor of this interface visible.
54
39
  #
55
- # @param action [Symbol] A symbol representing the method name to be called
56
- # on the Cursor instance.
57
- # @return [String] The escape sequence sent to the Terminal on completion
58
- # of the action.
59
- def use(action)
60
- name = Focus.current
61
- cursor = Cursor.new(find(name))
62
-
63
- storage.store(name, cursor.send(action))
64
-
65
- Terminal.output(cursor.to_s)
40
+ # @return [Cursor]
41
+ def show
42
+ find_or_create(Focus.current).show
66
43
  end
67
44
 
68
45
  private
69
46
 
47
+ # @return [Class]
48
+ def entity
49
+ Cursor
50
+ end
51
+
70
52
  # Returns an empty collection ready for the storing of cursors by name with
71
53
  # current attributes.
72
54
  #
73
- # @api private
74
55
  # @example
75
56
  # { 'holmium' => {
76
57
  # name: 'holmium',
@@ -83,14 +64,6 @@ module Vedeu
83
64
  {}
84
65
  end
85
66
 
86
- # @api private
87
- # @param name [String]
88
- # @raise [CursorNotFound] When the entity cannot be found with this name.
89
- # @return [CursorNotFound]
90
- def not_found(name)
91
- fail CursorNotFound, "Cursor was not found with this name: #{name.to_s}."
92
- end
93
-
94
67
  end # Cursors
95
68
 
96
69
  end # Vedeu
@@ -2,6 +2,8 @@ module Vedeu
2
2
 
3
3
  # Provides a mechanism for storing and retrieving events by name. A single
4
4
  # name can contain many events. Also, an event can trigger other events.
5
+ #
6
+ # @api private
5
7
  module Events
6
8
 
7
9
  include Repository
@@ -47,7 +49,6 @@ module Vedeu
47
49
  # Returns an empty collection ready for the storing of events by name with
48
50
  # associated event instance.
49
51
  #
50
- # @api private
51
52
  # @return [Hash]
52
53
  def in_memory
53
54
  Hash.new { |hash, key| hash[key] = { events: [] } }
@@ -14,20 +14,9 @@ module Vedeu
14
14
  # System events which when called will change which interface is currently
15
15
  # focussed. When the interface is brought into focus, its cursor position
16
16
  # and visibility is restored.
17
- Vedeu.event(:_focus_by_name_) do |name|
18
- Vedeu::Focus.by_name(name)
19
- Vedeu.trigger(:_cursor_refresh_)
20
- end
21
-
22
- Vedeu.event(:_focus_next_) do
23
- Vedeu::Focus.next_item
24
- Vedeu.trigger(:_cursor_refresh_)
25
- end
26
-
27
- Vedeu.event(:_focus_prev_) do
28
- Vedeu::Focus.prev_item
29
- Vedeu.trigger(:_cursor_refresh_)
30
- end
17
+ Vedeu.event(:_focus_by_name_) { |name| Vedeu::Focus.by_name(name) }
18
+ Vedeu.event(:_focus_next_) { Vedeu::Focus.next_item }
19
+ Vedeu.event(:_focus_prev_) { Vedeu::Focus.prev_item }
31
20
 
32
21
  # Add an interface name to the focus list unless it is already registered.
33
22
  #
@@ -57,6 +46,8 @@ module Vedeu
57
46
 
58
47
  Vedeu.log("Interface in focus: '#{current}'")
59
48
 
49
+ refresh
50
+
60
51
  current
61
52
  end
62
53
 
@@ -87,6 +78,8 @@ module Vedeu
87
78
 
88
79
  Vedeu.log("Interface in focus: '#{current}'")
89
80
 
81
+ refresh
82
+
90
83
  current
91
84
  end
92
85
 
@@ -98,9 +91,18 @@ module Vedeu
98
91
 
99
92
  Vedeu.log("Interface in focus: '#{current}'")
100
93
 
94
+ refresh
95
+
101
96
  current
102
97
  end
103
98
 
99
+ # Refresh the interface in focus.
100
+ #
101
+ # @return [Array]
102
+ def refresh
103
+ Vedeu.trigger("_refresh_#{current}_".to_sym)
104
+ end
105
+
104
106
  # Returns all registered interfaces by name.
105
107
  #
106
108
  # @return [Array]
@@ -110,7 +112,6 @@ module Vedeu
110
112
 
111
113
  # Returns a boolean indicating whether the named interface is registered.
112
114
  #
113
- # @api private
114
115
  # @return [Boolean]
115
116
  def registered?(name)
116
117
  return false if storage.empty?
@@ -122,7 +123,6 @@ module Vedeu
122
123
 
123
124
  # Returns an empty collection ready for the storing of interface names.
124
125
  #
125
- # @api private
126
126
  # @return [Array]
127
127
  def in_memory
128
128
  []
@@ -13,7 +13,7 @@ module Vedeu
13
13
  # exist, and rejecting the interface if it is already known.
14
14
  #
15
15
  # @param attributes [Hash]
16
- # @return [Groups|FalseClass]
16
+ # @return [Boolean]
17
17
  def add(attributes)
18
18
  validate_attributes!(attributes)
19
19
 
@@ -29,7 +29,6 @@ module Vedeu
29
29
  private
30
30
 
31
31
  # @see Vedeu::Refresh.register_event
32
- # @api private
33
32
  # @param attributes [Hash]
34
33
  # @return [Boolean]
35
34
  def register_event(attributes)
@@ -39,13 +38,11 @@ module Vedeu
39
38
  Vedeu::Refresh.register_event(:by_group, name, delay)
40
39
  end
41
40
 
42
- # @api private
43
41
  # @return [Hash]
44
42
  def in_memory
45
43
  Hash.new { |hash, key| hash[key] = Set.new }
46
44
  end
47
45
 
48
- # @api private
49
46
  # @param name [String]
50
47
  # @raise [GroupNotFound] When the entity cannot be found with this name.
51
48
  # @return [GroupNotFound]