vedeu 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +1 -1
  3. data/docs/events.md +11 -8
  4. data/lib/vedeu/api/api.rb +19 -43
  5. data/lib/vedeu/api/composition.rb +13 -8
  6. data/lib/vedeu/api/defined.rb +14 -4
  7. data/lib/vedeu/api/helpers.rb +8 -5
  8. data/lib/vedeu/api/interface.rb +15 -21
  9. data/lib/vedeu/api/keymap.rb +11 -5
  10. data/lib/vedeu/api/line.rb +6 -7
  11. data/lib/vedeu/api/menu.rb +9 -17
  12. data/lib/vedeu/api/stream.rb +8 -6
  13. data/lib/vedeu/application.rb +14 -12
  14. data/lib/vedeu/configuration/api.rb +33 -3
  15. data/lib/vedeu/configuration/cli.rb +23 -3
  16. data/lib/vedeu/configuration/configuration.rb +3 -2
  17. data/lib/vedeu/input/input.rb +6 -2
  18. data/lib/vedeu/launcher.rb +5 -2
  19. data/lib/vedeu/models/attributes/background.rb +3 -2
  20. data/lib/vedeu/models/attributes/coercions.rb +3 -2
  21. data/lib/vedeu/models/attributes/colour_translator.rb +11 -4
  22. data/lib/vedeu/models/attributes/foreground.rb +3 -2
  23. data/lib/vedeu/models/attributes/presentation.rb +3 -2
  24. data/lib/vedeu/models/colour.rb +3 -2
  25. data/lib/vedeu/models/composition.rb +5 -2
  26. data/lib/vedeu/models/cursor.rb +3 -2
  27. data/lib/vedeu/models/geometry.rb +48 -6
  28. data/lib/vedeu/models/interface.rb +12 -2
  29. data/lib/vedeu/models/keymap.rb +4 -2
  30. data/lib/vedeu/models/line.rb +5 -2
  31. data/lib/vedeu/models/stream.rb +12 -2
  32. data/lib/vedeu/models/style.rb +3 -2
  33. data/lib/vedeu/output/clear.rb +5 -2
  34. data/lib/vedeu/output/compositor.rb +4 -2
  35. data/lib/vedeu/output/refresh.rb +4 -6
  36. data/lib/vedeu/output/render.rb +17 -14
  37. data/lib/vedeu/output/view.rb +5 -2
  38. data/lib/vedeu/repositories/buffers.rb +16 -47
  39. data/lib/vedeu/repositories/cursors.rb +26 -28
  40. data/lib/vedeu/repositories/events.rb +33 -48
  41. data/lib/vedeu/repositories/focus.rb +24 -20
  42. data/lib/vedeu/repositories/groups.rb +17 -52
  43. data/lib/vedeu/repositories/interfaces.rb +21 -42
  44. data/lib/vedeu/repositories/keymaps.rb +9 -57
  45. data/lib/vedeu/repositories/menus.rb +15 -55
  46. data/lib/vedeu/support/common.rb +2 -2
  47. data/lib/vedeu/support/esc.rb +35 -2
  48. data/lib/vedeu/support/event.rb +7 -8
  49. data/lib/vedeu/support/exceptions.rb +47 -0
  50. data/lib/vedeu/support/grid.rb +11 -4
  51. data/lib/vedeu/support/keymap_validator.rb +9 -14
  52. data/lib/vedeu/support/log.rb +13 -3
  53. data/lib/vedeu/support/menu.rb +3 -2
  54. data/lib/vedeu/support/position.rb +3 -2
  55. data/lib/vedeu/support/registrar.rb +2 -23
  56. data/lib/vedeu/support/repository.rb +77 -0
  57. data/lib/vedeu/support/terminal.rb +12 -2
  58. data/lib/vedeu/support/trace.rb +127 -20
  59. data/lib/vedeu.rb +11 -46
  60. data/test/lib/vedeu/api/api_test.rb +14 -18
  61. data/test/lib/vedeu/api/defined_test.rb +16 -6
  62. data/test/lib/vedeu/api/interface_test.rb +5 -20
  63. data/test/lib/vedeu/api/menu_test.rb +1 -1
  64. data/test/lib/vedeu/models/geometry_test.rb +41 -0
  65. data/test/lib/vedeu/models/interface_test.rb +14 -0
  66. data/test/lib/vedeu/repositories/buffers_test.rb +6 -32
  67. data/test/lib/vedeu/repositories/cursors_test.rb +14 -0
  68. data/test/lib/vedeu/repositories/events_test.rb +18 -47
  69. data/test/lib/vedeu/repositories/focus_test.rb +18 -5
  70. data/test/lib/vedeu/repositories/groups_test.rb +3 -62
  71. data/test/lib/vedeu/repositories/interfaces_test.rb +13 -49
  72. data/test/lib/vedeu/repositories/keymaps_test.rb +0 -23
  73. data/test/lib/vedeu/repositories/menus_test.rb +3 -62
  74. data/test/lib/vedeu/support/esc_test.rb +24 -0
  75. data/test/lib/vedeu/support/keymap_validator_test.rb +19 -38
  76. data/test/lib/vedeu/support/repository_test.rb +70 -0
  77. data/test/test_helper.rb +2 -0
  78. data/vedeu.gemspec +3 -3
  79. metadata +10 -6
@@ -76,5 +76,7 @@ module Vedeu
76
76
  def buffer
77
77
  @_buffer ||= Vedeu::Buffers.latest(name)
78
78
  end
79
- end
80
- end
79
+
80
+ end # Compositor
81
+
82
+ end # Vedeu
@@ -60,15 +60,13 @@ module Vedeu
60
60
 
61
61
  end
62
62
 
63
- return false if Vedeu.events.registered?(event)
63
+ return false if Events.registered?(event)
64
64
 
65
- Vedeu.event(event, { delay: delay }) do
66
- Vedeu::Refresh.send(type, name)
67
- end
65
+ Events.add(event, { delay: delay }) { Vedeu::Refresh.send(type, name) }
68
66
 
69
67
  true
70
68
  end
71
69
 
72
- end
70
+ end # Refresh
73
71
 
74
- end
72
+ end # Vedeu
@@ -34,6 +34,8 @@ module Vedeu
34
34
  #
35
35
  # @return [String]
36
36
  def render
37
+ Vedeu.log("Rendering view: '#{interface.name}'")
38
+
37
39
  out = [ Clear.call(interface) ]
38
40
  processed_lines.each_with_index do |line, index|
39
41
  out << interface.origin(index)
@@ -64,11 +66,11 @@ module Vedeu
64
66
  new_streams = []
65
67
 
66
68
  new_streams = line.streams.map do |stream|
67
- next if stream.text.empty?
69
+ next if stream.content.empty?
68
70
 
69
- if (line_length += stream.text.size) >= width
71
+ if (line_length += stream.content.size) >= width
70
72
  remainder = width - line_length
71
- truncated = truncate(stream.text, remainder)
73
+ truncated = truncate(stream.content, remainder)
72
74
 
73
75
  build_stream(line, stream, truncated)
74
76
 
@@ -93,12 +95,12 @@ module Vedeu
93
95
  # @api private
94
96
  # @param line [Line]
95
97
  # @param stream [Stream]
96
- # @param text [String]
98
+ # @param content [String]
97
99
  # @return [Stream]
98
- def build_stream(line, stream, text)
100
+ def build_stream(line, stream, content)
99
101
  attributes = stream.view_attributes.merge!({
100
102
  parent: line.view_attributes,
101
- text: text,
103
+ text: content,
102
104
  })
103
105
 
104
106
  Stream.new(attributes)
@@ -127,17 +129,17 @@ module Vedeu
127
129
  # @param line [Line]
128
130
  # @return [Boolean]
129
131
  def exceeds_width?(line)
130
- line.streams.map(&:text).join.size > width
132
+ line.streams.map(&:content).join.size > width
131
133
  end
132
134
 
133
- # Truncates the provided text.
135
+ # Truncates the provided string.
134
136
  #
135
137
  # @api private
136
- # @param text [String] The text to be truncated.
137
- # @param value [Fixnum] The total length of the text after truncation.
138
+ # @param string [String] The string to be truncated.
139
+ # @param value [Fixnum] The total length of the string after truncation.
138
140
  # @return [String]
139
- def truncate(text, value)
140
- text.chomp.slice(0...value)
141
+ def truncate(string, value)
142
+ string.chomp.slice(0...value)
141
143
  end
142
144
 
143
145
  # Provides the collection of visible lines associated with the interface.
@@ -199,5 +201,6 @@ module Vedeu
199
201
  }
200
202
  end
201
203
 
202
- end
203
- end
204
+ end # Render
205
+
206
+ end # Vedeu
@@ -33,6 +33,8 @@ module Vedeu
33
33
  end
34
34
  end
35
35
 
36
+ # @raise [NotImplemented] Subclasses of this class must implement this
37
+ # method.
36
38
  # @return [Exception]
37
39
  def render
38
40
  fail NotImplemented, 'Implement #render on your subclass of Vedeu::View.'
@@ -59,5 +61,6 @@ module Vedeu
59
61
  render
60
62
  end
61
63
 
62
- end
63
- end
64
+ end # View
65
+
66
+ end # Vedeu
@@ -6,7 +6,8 @@ module Vedeu
6
6
  # @api private
7
7
  module Buffers
8
8
 
9
- include Vedeu::Common
9
+ include Common
10
+ include Repository
10
11
  extend self
11
12
 
12
13
  # Add an interface view into the back buffer. If the buffer is already
@@ -16,6 +17,8 @@ module Vedeu
16
17
  # @param attributes [Hash]
17
18
  # @return [String]
18
19
  def add(attributes)
20
+ validate_attributes!(attributes)
21
+
19
22
  if registered?(attributes[:name])
20
23
  buffer = find(attributes[:name])
21
24
 
@@ -32,16 +35,6 @@ module Vedeu
32
35
  attributes[:name]
33
36
  end
34
37
 
35
- # Find the buffer by name.
36
- #
37
- # @param name [String]
38
- # @return [Hash]
39
- def find(name)
40
- storage.fetch(name) do
41
- fail BufferNotFound, "Cannot find buffer with this name: #{name.to_s}."
42
- end
43
- end
44
-
45
38
  # Returns the latest content for the named buffer. The latest content always
46
39
  # goes on to the back buffer. The content which was last output is on the
47
40
  # front buffer.
@@ -71,30 +64,6 @@ module Vedeu
71
64
  end
72
65
  end
73
66
 
74
- # Returns a collection of the names of all registered buffers.
75
- #
76
- # @return [Array]
77
- def registered
78
- storage.keys
79
- end
80
-
81
- # Returns a boolean indicating whether the named buffer is registered.
82
- #
83
- # @api private
84
- # @param name [String]
85
- # @return [Boolean]
86
- def registered?(name)
87
- storage.key?(name)
88
- end
89
-
90
- # Reset the buffers repository; removing all buffers. This does not delete
91
- # the interfaces themselves.
92
- #
93
- # @return [Hash]
94
- def reset
95
- @_storage = in_memory
96
- end
97
-
98
67
  private
99
68
 
100
69
  # Swap the named back buffer into the front buffer of the same name.
@@ -135,7 +104,7 @@ module Vedeu
135
104
  # @param name [String]
136
105
  # @return [Hash|Nil]
137
106
  def back_buffer(name)
138
- find(name).fetch(:back_buffer, nil)
107
+ find(name)[:back_buffer]
139
108
  end
140
109
 
141
110
  # Return the named front buffer.
@@ -144,15 +113,7 @@ module Vedeu
144
113
  # @param name [String]
145
114
  # @return [Hash|Nil]
146
115
  def front_buffer(name)
147
- find(name).fetch(:front_buffer, nil)
148
- end
149
-
150
- # Access to the storage for this repository.
151
- #
152
- # @api private
153
- # @return [Hash]
154
- def storage
155
- @_storage ||= in_memory
116
+ find(name)[:front_buffer]
156
117
  end
157
118
 
158
119
  # @api private
@@ -166,6 +127,14 @@ module Vedeu
166
127
  end
167
128
  end
168
129
 
169
- end
130
+ # @api private
131
+ # @param name [String]
132
+ # @raise [BufferNotFound] When the entity cannot be found with this name.
133
+ # @return [BufferNotFound]
134
+ def not_found(name)
135
+ fail BufferNotFound, "Cannot find buffer with this name: #{name.to_s}."
136
+ end
137
+
138
+ end # Buffers
170
139
 
171
- end
140
+ end # Vedeu
@@ -7,6 +7,7 @@ module Vedeu
7
7
  module Cursors
8
8
 
9
9
  include Common
10
+ include Repository
10
11
  extend self
11
12
 
12
13
  # System events which when called will update the cursor position or
@@ -24,7 +25,9 @@ module Vedeu
24
25
  # @param attributes [Hash]
25
26
  # @return [Hash]
26
27
  def add(attributes)
27
- return false unless defined_value?(attributes[:name])
28
+ validate_attributes!(attributes)
29
+
30
+ Vedeu.log("Registering cursor: '#{attributes[:name]}'")
28
31
 
29
32
  storage.store(attributes[:name], {
30
33
  name: attributes[:name],
@@ -34,25 +37,16 @@ module Vedeu
34
37
  })
35
38
  end
36
39
 
37
- # Find the cursor attributes by name.
40
+ # Saves the attributes in the repository for future use.
38
41
  #
39
- # @param name [String]
42
+ # @param attributes [Hash]
40
43
  # @return [Hash]
41
- def find(name)
42
- storage.fetch(name) do
43
- fail CursorNotFound,
44
- "Cursor was not found with this name: #{name.to_s}."
45
- end
46
- end
44
+ def update(attributes)
45
+ return false unless defined_value?(attributes[:name])
47
46
 
48
- # Returns a boolean indicating whether the named interface is registered.
49
- #
50
- # @api private
51
- # @return [Boolean]
52
- def registered?(name)
53
- return false if storage.empty?
47
+ Vedeu.log("Updating cursor: '#{attributes[:name]}'")
54
48
 
55
- storage.keys.include?(name)
49
+ storage.store(attributes[:name], attributes)
56
50
  end
57
51
 
58
52
  # Perform an action (moving, showing or hiding) and save the new cursor
@@ -73,26 +67,30 @@ module Vedeu
73
67
 
74
68
  private
75
69
 
76
- # Access to the storage for this repository.
70
+ # Returns an empty collection ready for the storing of cursors by name with
71
+ # current attributes.
77
72
  #
78
73
  # @api private
79
74
  # @example
80
- # { 'holmium' => { name: 'holmium', y: 12, x: 6, state: :show } }
75
+ # { 'holmium' => {
76
+ # name: 'holmium',
77
+ # state: :show,
78
+ # x: 1,
79
+ # y: 1 } }
81
80
  #
82
81
  # @return [Hash]
83
- def storage
84
- @_storage ||= in_memory
82
+ def in_memory
83
+ {}
85
84
  end
86
85
 
87
- # Returns an empty collection ready for the storing of cursors by name with
88
- # current attributes.
89
- #
90
86
  # @api private
91
- # @return [Hash]
92
- def in_memory
93
- {}
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}."
94
92
  end
95
93
 
96
- end
94
+ end # Cursors
97
95
 
98
- end
96
+ end # Vedeu
@@ -1,55 +1,36 @@
1
1
  module Vedeu
2
2
 
3
3
  # Provides a mechanism for storing and retrieving events by name. A single
4
- # name can contain many events. Also an event can trigger other events.
5
- #
6
- # @api private
7
- class Events
4
+ # name can contain many events. Also, an event can trigger other events.
5
+ module Events
8
6
 
9
- # Initializes a new Events class.
10
- #
11
- # @param block [Proc]
12
- # @return [Events]
13
- def initialize(&block)
14
- @handlers = Hash.new { |hash, key| hash[key] = { events: [] } }
15
-
16
- instance_eval(&block) if block_given?
17
- end
7
+ include Repository
8
+ extend self
18
9
 
19
10
  # @see Vedeu::API#event
20
- def event(name, opts = {}, &block)
21
- Vedeu.log("Registering event '#{name}'")
11
+ def add(name, opts = {}, &block)
12
+ Vedeu.log("Registering event: '#{name}'")
22
13
 
23
14
  options = opts.merge!({ event_name: name })
24
15
 
25
- handlers[name][:events] << Event.new(block, options)
26
- handlers[name]
16
+ storage[name][:events] << Event.new(block, options)
17
+ storage[name]
27
18
  end
19
+ alias_method :event, :add
28
20
 
29
21
  # @see Vedeu::API#unevent
30
- def unevent(name)
31
- handlers.delete_if { |k, v| k == name }
32
- end
22
+ def remove(name)
23
+ return false unless registered?(name)
33
24
 
34
- # Returns a collection of the names of all the registered events.
35
- #
36
- # @return [Array]
37
- def registered
38
- handlers.keys
39
- end
25
+ storage.delete(name) { false }
40
26
 
41
- # Returns a Boolean indicating whether the named event is registered.
42
- #
43
- # @api private
44
- # @param name [Symbol] The name of the event to check.
45
- # @return [Boolean]
46
- def registered?(name)
47
- handlers.key?(name)
27
+ true
48
28
  end
29
+ alias_method :unevent, :remove
49
30
 
50
31
  # @see Vedeu::API#trigger
51
- def trigger(name, *args)
52
- results = handlers[name][:events].map { |event| event.trigger(*args) }
32
+ def use(name, *args)
33
+ results = storage[name][:events].map { |event| event.trigger(*args) }
53
34
 
54
35
  if results.one?
55
36
  results.first
@@ -59,23 +40,27 @@ module Vedeu
59
40
 
60
41
  end
61
42
  end
43
+ alias_method :trigger, :use
62
44
 
63
- # Remove all registered events. Used for testing purposes.
45
+ private
46
+
47
+ # Returns an empty collection ready for the storing of events by name with
48
+ # associated event instance.
64
49
  #
50
+ # @api private
65
51
  # @return [Hash]
66
- def reset
67
- @handlers = Hash.new { |hash, key| hash[key] = { events: [] } }
52
+ def in_memory
53
+ Hash.new { |hash, key| hash[key] = { events: [] } }
68
54
  end
69
55
 
70
- private
56
+ # System events needed by Vedeu to run.
57
+ add(:_clear_) { Terminal.clear_screen }
58
+ add(:_exit_) { Vedeu::Application.stop }
59
+ add(:_keypress_) { |key| Vedeu.keypress(key) }
60
+ add(:_log_) { |msg| Vedeu.log(msg) }
61
+ add(:_mode_switch_) { fail ModeSwitch }
62
+ add(:_resize_, { delay: 0.25 }) { Vedeu.resize }
71
63
 
72
- attr_reader :handlers
73
-
74
- # @api private
75
- # @return []
76
- def method_missing(method, *args, &block)
77
- @self_before_instance_eval.send(method, *args, &block)
78
- end
64
+ end # Events
79
65
 
80
- end
81
- end
66
+ end # Vedeu
@@ -7,6 +7,8 @@ module Vedeu
7
7
  # @api private
8
8
  module Focus
9
9
 
10
+ include Common
11
+ include Repository
10
12
  extend self
11
13
 
12
14
  # System events which when called will change which interface is currently
@@ -32,6 +34,8 @@ module Vedeu
32
34
  # @param attributes [String]
33
35
  # @return [Array]
34
36
  def add(attributes)
37
+ validate_attributes!(attributes)
38
+
35
39
  if registered?(attributes[:name])
36
40
  storage
37
41
 
@@ -44,32 +48,45 @@ module Vedeu
44
48
  # Focus an interface by name.
45
49
  #
46
50
  # @param name [String]
51
+ # @raise [InterfaceNotFound] When the interface cannot be found.
47
52
  # @return [String]
48
53
  def by_name(name)
49
54
  fail InterfaceNotFound unless storage.include?(name)
50
55
 
51
56
  storage.rotate!(storage.index(name))
52
57
 
58
+ Vedeu.log("Interface in focus: '#{current}'")
59
+
53
60
  current
54
61
  end
55
62
 
56
63
  # Return the interface currently focussed.
57
64
  #
65
+ # @raise [NoInterfacesDefined] When no interfaces are defined, we cannot
66
+ # make one focussed.
58
67
  # @return [String]
59
68
  def current
60
69
  fail NoInterfacesDefined if storage.empty?
61
70
 
62
- Vedeu.log("Interface in focus: '#{storage.first}'")
63
-
64
71
  storage.first
65
72
  end
66
73
 
74
+ # Returns a boolean indicating whether the named interface is focussed.
75
+ #
76
+ # @param name [String]
77
+ # @return [Boolean]
78
+ def current?(name)
79
+ current == name
80
+ end
81
+
67
82
  # Put the next interface relative to the current interfaces in focus.
68
83
  #
69
84
  # @return [String]
70
85
  def next_item
71
86
  storage.rotate!
72
87
 
88
+ Vedeu.log("Interface in focus: '#{current}'")
89
+
73
90
  current
74
91
  end
75
92
 
@@ -79,6 +96,8 @@ module Vedeu
79
96
  def prev_item
80
97
  storage.rotate!(-1)
81
98
 
99
+ Vedeu.log("Interface in focus: '#{current}'")
100
+
82
101
  current
83
102
  end
84
103
 
@@ -99,24 +118,8 @@ module Vedeu
99
118
  storage.include?(name)
100
119
  end
101
120
 
102
- # Reset the focus repository; removing all items. This does not delete
103
- # the interfaces themselves.
104
- #
105
- # @return [Hash]
106
- def reset
107
- @_storage = in_memory
108
- end
109
-
110
121
  private
111
122
 
112
- # Access to the storage for this repository.
113
- #
114
- # @api private
115
- # @return [Array]
116
- def storage
117
- @_storage ||= in_memory
118
- end
119
-
120
123
  # Returns an empty collection ready for the storing of interface names.
121
124
  #
122
125
  # @api private
@@ -125,5 +128,6 @@ module Vedeu
125
128
  []
126
129
  end
127
130
 
128
- end
129
- end
131
+ end # Focus
132
+
133
+ end # Vedeu
@@ -5,7 +5,8 @@ module Vedeu
5
5
  # @api private
6
6
  module Groups
7
7
 
8
- include Vedeu::Common
8
+ include Common
9
+ include Repository
9
10
  extend self
10
11
 
11
12
  # Add an interface name to a group, creating the group if it doesn't already
@@ -14,6 +15,8 @@ module Vedeu
14
15
  # @param attributes [Hash]
15
16
  # @return [Groups|FalseClass]
16
17
  def add(attributes)
18
+ validate_attributes!(attributes)
19
+
17
20
  return false unless defined_value?(attributes[:group])
18
21
 
19
22
  storage[attributes[:group]] << attributes[:name]
@@ -23,46 +26,6 @@ module Vedeu
23
26
  true
24
27
  end
25
28
 
26
- # Return the whole repository.
27
- #
28
- # @return [Set]
29
- def all
30
- storage
31
- end
32
-
33
- # Find a group by name and return all of its associated interfaces.
34
- #
35
- # @param name [String]
36
- # @return [Set]
37
- def find(name)
38
- storage.fetch(name) do
39
- fail GroupNotFound,
40
- "Cannot find interface group with this name: #{name.to_s}."
41
- end
42
- end
43
-
44
- # Returns a collection of the names of all registered groups.
45
- #
46
- # @return [Array]
47
- def registered
48
- storage.keys
49
- end
50
-
51
- # Returns a Boolean indicating whether the named group is registered.
52
- #
53
- # @return [Boolean]
54
- def registered?(name)
55
- storage.key?(name)
56
- end
57
-
58
- # Reset the groups repository; removing all groups. This does not delete
59
- # the interfaces themselves.
60
- #
61
- # @return [Hash]
62
- def reset
63
- @_storage = in_memory
64
- end
65
-
66
29
  private
67
30
 
68
31
  # @see Vedeu::Refresh.register_event
@@ -70,25 +33,27 @@ module Vedeu
70
33
  # @param attributes [Hash]
71
34
  # @return [Boolean]
72
35
  def register_event(attributes)
73
- name = attributes[:group]
74
- delay = attributes[:delay] || 0.0
36
+ name = attributes[:group]
37
+ delay = attributes[:delay] || 0.0
75
38
 
76
39
  Vedeu::Refresh.register_event(:by_group, name, delay)
77
40
  end
78
41
 
79
- # Access to the storage for this repository.
80
- #
81
42
  # @api private
82
43
  # @return [Hash]
83
- def storage
84
- @_storage ||= in_memory
44
+ def in_memory
45
+ Hash.new { |hash, key| hash[key] = Set.new }
85
46
  end
86
47
 
87
48
  # @api private
88
- # @return [Hash]
89
- def in_memory
90
- Hash.new { |hash, key| hash[key] = Set.new }
49
+ # @param name [String]
50
+ # @raise [GroupNotFound] When the entity cannot be found with this name.
51
+ # @return [GroupNotFound]
52
+ def not_found(name)
53
+ fail GroupNotFound,
54
+ "Cannot find interface group with this name: #{name.to_s}."
91
55
  end
92
56
 
93
- end
94
- end
57
+ end # Groups
58
+
59
+ end # Vedeu