vedeu 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -5,7 +5,8 @@ module Vedeu
5
5
  # @api private
6
6
  module Interfaces
7
7
 
8
- include Vedeu::Common
8
+ include Common
9
+ include Repository
9
10
  extend self
10
11
 
11
12
  # Stores the interface attributes defined by the API.
@@ -13,9 +14,9 @@ module Vedeu
13
14
  # @param attributes [Hash]
14
15
  # @return [Hash|FalseClass]
15
16
  def add(attributes)
16
- return false unless defined_value?(attributes[:name])
17
+ validate_attributes!(attributes)
17
18
 
18
- Vedeu.log("Registering interface '#{attributes[:name]}'")
19
+ Vedeu.log("Registering interface: '#{attributes[:name]}'")
19
20
 
20
21
  storage.store(attributes[:name], attributes)
21
22
 
@@ -24,36 +25,12 @@ module Vedeu
24
25
  true
25
26
  end
26
27
 
27
- # Return the whole repository.
28
- #
29
- # @return [Hash]
30
- def all
31
- storage
32
- end
33
-
34
- # Find an interface by name and return the attributes used to define it.
28
+ # Create an instance of Interface from the stored attributes.
35
29
  #
36
30
  # @param name [String]
37
- # @return [Hash]
38
- def find(name)
39
- storage.fetch(name) do
40
- fail InterfaceNotFound,
41
- "Interface was not found with this name: #{name.to_s}."
42
- end
43
- end
44
-
45
- # Returns a collection of the names of all the registered interfaces.
46
- #
47
- # @return [Array]
48
- def registered
49
- storage.keys
50
- end
51
-
52
- # Returns a boolean indicating whether the named interface is registered.
53
- #
54
- # @return [Boolean]
55
- def registered?(name)
56
- storage.key?(name)
31
+ # @return [Interface]
32
+ def build(name)
33
+ Interface.new(find(name))
57
34
  end
58
35
 
59
36
  # Reset the interfaces repository; removing all registered interfaces.
@@ -72,25 +49,27 @@ module Vedeu
72
49
  # @param attributes [Hash]
73
50
  # @return [Boolean]
74
51
  def register_event(attributes)
75
- name = attributes[:name]
76
- delay = attributes[:delay] || 0.0
52
+ name = attributes[:name]
53
+ delay = attributes[:delay] || 0.0
77
54
 
78
55
  Vedeu::Refresh.register_event(:by_name, name, delay)
79
56
  end
80
57
 
81
- # Access to the storage for this repository.
82
- #
83
58
  # @api private
84
59
  # @return [Hash]
85
- def storage
86
- @_storage ||= in_memory
60
+ def in_memory
61
+ {}
87
62
  end
88
63
 
89
64
  # @api private
90
- # @return [Hash]
91
- def in_memory
92
- {}
65
+ # @param name [String]
66
+ # @raise [InterfaceNotFound] When the entity cannot be found with this name.
67
+ # @return [InterfaceNotFound]
68
+ def not_found(name)
69
+ fail InterfaceNotFound,
70
+ "Interface was not found with this name: #{name.to_s}."
93
71
  end
94
72
 
95
- end
96
- end
73
+ end # Interfaces
74
+
75
+ end # Vedeu
@@ -5,7 +5,8 @@ module Vedeu
5
5
  # @api private
6
6
  module Keymaps
7
7
 
8
- include Vedeu::Common
8
+ include Common
9
+ include Repository
9
10
  extend self
10
11
 
11
12
  # Stores the keymap attributes defined by the API.
@@ -30,14 +31,8 @@ module Vedeu
30
31
  true
31
32
  end
32
33
 
33
- # Return the whole repository of keymaps.
34
- #
35
- # @return [Hash]
36
- def all
37
- storage
38
- end
39
-
40
- # Find a keymap by interface name.
34
+ # Find a keymap by named interface. Return an empty collection when there =
35
+ # are no specific keys defined for the named interface.
41
36
  #
42
37
  # @param name [String]
43
38
  # @return [Hash]
@@ -86,30 +81,6 @@ module Vedeu
86
81
  end.map { |_, v| v.keys }.flatten.uniq
87
82
  end
88
83
 
89
- # Returns a collection of the interface names of all the registered keymaps.
90
- #
91
- # @return [Array]
92
- def registered
93
- storage.keys
94
- end
95
-
96
- # Returns a boolean indicating whether the named interface has a keymap
97
- # registered.
98
- #
99
- # @param name [String]
100
- # @return [Boolean]
101
- def registered?(name)
102
- storage.key?(name)
103
- end
104
-
105
- # Reset the keymaps repository; removing all registered keymaps. Only the
106
- # system keymap will remain.
107
- #
108
- # @return [Hash]
109
- def reset
110
- @_storage = in_memory
111
- end
112
-
113
84
  # Return a boolean indicating whether the key is registered as a system key.
114
85
  #
115
86
  # @param key [String|Symbol]
@@ -177,13 +148,6 @@ module Vedeu
177
148
  Vedeu.trigger(event)
178
149
  end
179
150
 
180
- # @param key [String|Symbol]
181
- # @param interface [String]
182
- # @return []
183
- def validate(key, interface = '')
184
- Vedeu::KeymapValidator.check(storage, key, interface)
185
- end
186
-
187
151
  # Registers the key.
188
152
  #
189
153
  # @api private
@@ -192,15 +156,11 @@ module Vedeu
192
156
  # @return []
193
157
  def register(attributes, interface = '')
194
158
  attributes[:keys].map do |keymap|
195
- valid, message = validate(keymap[:key], interface)
196
-
197
- fail KeyInUse, message unless valid
159
+ KeymapValidator.check(storage, keymap[:key], interface)
198
160
 
199
- Vedeu.log("Registering key '#{keymap[:key]}' with " \
200
- "'#{namespace(interface)}'")
161
+ Vedeu.log("Registering key: '#{keymap[:key]}' with '#{namespace(interface)}'")
201
162
 
202
- storage[namespace(interface)]
203
- .merge!({ keymap[:key] => keymap[:action] })
163
+ storage[namespace(interface)].merge!({ keymap[:key] => keymap[:action] })
204
164
  end
205
165
  end
206
166
 
@@ -220,20 +180,12 @@ module Vedeu
220
180
  proc { :noop }
221
181
  end
222
182
 
223
- # Access to the storage for this repository.
224
- #
225
- # @api private
226
- # @return [Array]
227
- def storage
228
- @_storage ||= in_memory
229
- end
230
-
231
183
  # @api private
232
184
  # @return [Array]
233
185
  def in_memory
234
186
  { '_global_keymap_' => {} }
235
187
  end
236
188
 
237
- end
189
+ end # Keymaps
238
190
 
239
- end
191
+ end # Vedeu
@@ -6,6 +6,7 @@ module Vedeu
6
6
  module Menus
7
7
 
8
8
  include Common
9
+ include Repository
9
10
  extend self
10
11
 
11
12
  # System events which when called with the appropriate menu name will
@@ -24,50 +25,17 @@ module Vedeu
24
25
  # Stores the menu attributes defined by the API.
25
26
  #
26
27
  # @param attributes [Hash]
27
- # @return [Hash|FalseClass]
28
+ # @return [Hash|MissingRequired]
28
29
  def add(attributes)
29
- return false unless defined_value?(attributes[:name])
30
+ validate_attributes!(attributes)
30
31
 
31
- Vedeu.log("Registering menu '#{attributes[:name]}'")
32
+ Vedeu.log("Registering menu: '#{attributes[:name]}'")
32
33
 
33
34
  attributes.merge!({ items: Vedeu::Menu.new(attributes[:items]) })
34
35
 
35
36
  storage.store(attributes[:name], attributes)
36
37
  end
37
38
 
38
- # Return the whole repository of menus.
39
- #
40
- # @return [Hash]
41
- def all
42
- storage
43
- end
44
-
45
- # Find a menu by name.
46
- #
47
- # @param name [String]
48
- # @return [Hash]
49
- def find(name)
50
- storage.fetch(name) do
51
- fail MenuNotFound,
52
- "Menu was not found with this name: #{name.to_s}."
53
- end
54
- end
55
-
56
- # Returns a collection of the names of all the registered menus.
57
- #
58
- # @return [Array]
59
- def registered
60
- storage.keys
61
- end
62
-
63
- # Returns a boolean indicating whether the named menu is registered.
64
- #
65
- # @param name [String]
66
- # @return [Boolean]
67
- def registered?(name)
68
- storage.key?(name)
69
- end
70
-
71
39
  # Removes the menu from the repository and associated events.
72
40
  #
73
41
  # @param name [String]
@@ -80,15 +48,6 @@ module Vedeu
80
48
  true
81
49
  end
82
50
 
83
- # Reset the menus repository; removing all registered menus.
84
- # This will delete the menus themselves, and the client application
85
- # will need to either redefine menus before using them, or restart.
86
- #
87
- # @return [Hash]
88
- def reset
89
- @_storage = in_memory
90
- end
91
-
92
51
  # Access a menu by name.
93
52
  #
94
53
  # @param name [String]
@@ -99,14 +58,6 @@ module Vedeu
99
58
 
100
59
  private
101
60
 
102
- # Access to the storage for this repository.
103
- #
104
- # @api private
105
- # @return [Hash]
106
- def storage
107
- @_storage ||= in_memory
108
- end
109
-
110
61
  # Returns an empty collection ready for the storing of menus by name with
111
62
  # associated menu instance.
112
63
  #
@@ -116,5 +67,14 @@ module Vedeu
116
67
  {}
117
68
  end
118
69
 
119
- end
120
- end
70
+ # @api private
71
+ # @param name [String]
72
+ # @raise [MenuNotFound] When the entity cannot be found with this name.
73
+ # @return [MenuNotFound]
74
+ def not_found(name)
75
+ fail MenuNotFound, "Menu was not found with this name: #{name.to_s}."
76
+ end
77
+
78
+ end # Menus
79
+
80
+ end # Vedeu
@@ -16,6 +16,6 @@ module Vedeu
16
16
  false
17
17
  end
18
18
 
19
- end
20
- end
19
+ end # Common
21
20
 
21
+ end # Vedeu
@@ -8,6 +8,38 @@ module Vedeu
8
8
 
9
9
  extend self
10
10
 
11
+ # Dynamically creates methods for each terminal named colour. When a block
12
+ # is given, then the colour is reset to 'default' once the block is called.
13
+ #
14
+ # @example
15
+ # Esc.red # => "\e[31m"
16
+ #
17
+ # Esc.red { 'some text' } # => "\e[31msome text\e[39m"
18
+ #
19
+ # Esc.on_blue # => "\e[44m"
20
+ #
21
+ # Esc.on_blue { 'some text' } # => "\e[44msome text\e[49m"
22
+ #
23
+ # @return [String]
24
+ {
25
+ black: 30,
26
+ red: 31,
27
+ green: 32,
28
+ yellow: 33,
29
+ blue: 34,
30
+ magenta: 35,
31
+ cyan: 36,
32
+ white: 37,
33
+ default: 39,
34
+ }.each do |key, code|
35
+ define_method(key) do |&blk|
36
+ "\e[#{code}m" + (blk ? blk.call + "\e[39m" : '')
37
+ end
38
+ define_method('on_' + key.to_s) do |&blk|
39
+ "\e[#{code + 10}m" + (blk ? blk.call + "\e[49m" : '')
40
+ end
41
+ end
42
+
11
43
  # Return the escape sequence required to position the cursor at a particular
12
44
  # point on the screen. When passed a block, will do the aforementioned,
13
45
  # call the block and then reposition to this location.
@@ -199,5 +231,6 @@ module Vedeu
199
231
  "\e[24m"
200
232
  end
201
233
 
202
- end
203
- end
234
+ end # Esc
235
+
236
+ end # Vedeu
@@ -67,12 +67,11 @@ module Vedeu
67
67
  # @return [Boolean]
68
68
  def throttle_expired?
69
69
  if elapsed_time > delay
70
- Vedeu.log("Event throttle has expired for '#{event_name}', executing " \
71
- "event.")
72
70
  true
73
71
 
74
72
  else
75
- Vedeu.log("Event throttle not yet expired for '#{event_name}'.")
73
+ Vedeu.log("Throttling event '#{event_name}'")
74
+
76
75
  false
77
76
 
78
77
  end
@@ -98,12 +97,11 @@ module Vedeu
98
97
  # @return [Boolean]
99
98
  def debounce_expired?
100
99
  if set_executed > deadline
101
- Vedeu.log("Event debounce has expired for '#{event_name}', executing " \
102
- "event.")
103
100
  true
104
101
 
105
102
  else
106
- Vedeu.log("Event debounce not yet expired for '#{event_name}'.")
103
+ Vedeu.log("Debouncing event '#{event_name}'")
104
+
107
105
  false
108
106
 
109
107
  end
@@ -187,5 +185,6 @@ module Vedeu
187
185
  }
188
186
  end
189
187
 
190
- end
191
- end
188
+ end # Event
189
+
190
+ end # Vedeu
@@ -0,0 +1,47 @@
1
+ module Vedeu
2
+
3
+ # Raised when Vedeu attempts to access a named buffer that does not exist.
4
+ BufferNotFound = Class.new(StandardError)
5
+
6
+ # Raised when a cursor cannot be found by name.
7
+ CursorNotFound = Class.new(StandardError)
8
+
9
+ # Raised when trying to access a group of interfaces which do not exist by
10
+ # this name.
11
+ GroupNotFound = Class.new(StandardError)
12
+
13
+ # Raised when an interface cannot be found by name.
14
+ InterfaceNotFound = Class.new(StandardError)
15
+
16
+ # Raised when Vedeu attempts to parse a {Vedeu.view} or {Vedeu.interface} and
17
+ # encounters a problem.
18
+ InvalidSyntax = Class.new(StandardError)
19
+
20
+ # Raised when attempting to assign a key which is already in use.
21
+ KeyInUse = Class.new(StandardError)
22
+
23
+ # Raised when a menu cannot be found by name.
24
+ MenuNotFound = Class.new(StandardError)
25
+
26
+ # Raised when the attributes argument to {Vedeu::Registrar} does not contain
27
+ # a required key or the value to that key is nil or empty.
28
+ MissingRequired = Class.new(StandardError)
29
+
30
+ # Raised intentionally when the client application wishes to switch between
31
+ # cooked and raw (or vice versa) terminal modes. Vedeu is hard-wired to use
32
+ # the `Escape` key to trigger this change for the time being.
33
+ ModeSwitch = Class.new(StandardError)
34
+
35
+ # Raised when attempting to reach the currently in focus interface, when no
36
+ # interfaces have been defined yet.
37
+ NoInterfacesDefined = Class.new(StandardError)
38
+
39
+ # Raised to remind me (or client application developers) that the subclass
40
+ # implements the functionality sought.
41
+ NotImplemented = Class.new(StandardError)
42
+
43
+ # Raised when trying to access an interface column less than 1 or greater
44
+ # than 12. Vedeu is hard-wired to a 12-column layout for the time being.
45
+ OutOfRange = Class.new(StandardError)
46
+
47
+ end # Vedeu
@@ -16,7 +16,8 @@ class Fixnum
16
16
  def columns
17
17
  Vedeu::Grid.columns(self)
18
18
  end
19
- end
19
+
20
+ end # Fixnum
20
21
 
21
22
  module Vedeu
22
23
 
@@ -38,9 +39,12 @@ module Vedeu
38
39
  @value = value
39
40
  end
40
41
 
42
+ # @raise [OutOfRange] When the value parameter is not between 1 and 12
43
+ # inclusive.
41
44
  # @return [Fixnum|OutOfRange]
42
45
  def columns
43
- fail OutOfRange, 'Valid range is 1..12.' if out_of_range?
46
+ fail OutOfRange,
47
+ 'Valid value between 1 and 12 inclusive.' if out_of_range?
44
48
 
45
49
  column * value
46
50
  end
@@ -49,6 +53,8 @@ module Vedeu
49
53
 
50
54
  attr_reader :value
51
55
 
56
+ # Returns the width of a single column in characters.
57
+ #
52
58
  # @api private
53
59
  # @return [Fixnum]
54
60
  def column
@@ -67,5 +73,6 @@ module Vedeu
67
73
  value < 1 || value > 12
68
74
  end
69
75
 
70
- end
71
- end
76
+ end # Grid
77
+
78
+ end # Vedeu
@@ -29,27 +29,26 @@ module Vedeu
29
29
  @storage, @key, @interface = storage, key, interface
30
30
  end
31
31
 
32
+ # @raise [KeyInUse] When the key is already in use.
32
33
  # @see KeymapValidator.check
33
34
  def check
34
35
  if system_key?(key)
35
- [false, fail_message(key) + ' by the system.']
36
+ fail KeyInUse, "'#{key}' is already in use by the system."
36
37
 
37
38
  elsif global_key?(key)
38
- [false, fail_message(key) + ' as a global key.']
39
+ fail KeyInUse, "'#{key}' is already in use as a global key."
39
40
 
40
41
  elsif interface_key?(key, interface)
41
42
  if defined_value?(interface)
42
- [false, fail_message(key) + ' by this interface.']
43
+ fail KeyInUse, "'#{key}' is already in use by this interface."
43
44
 
44
45
  else
45
- [false, fail_message(key) + ' by another interface and therefore ' \
46
- 'cannot be global.']
46
+ fail KeyInUse, "'#{key}' is already in use and cannot be global."
47
47
 
48
48
  end
49
- else
50
- [true, 'Key can be registered.']
51
-
52
49
  end
50
+
51
+ true
53
52
  end
54
53
 
55
54
  private
@@ -96,10 +95,6 @@ module Vedeu
96
95
  Configuration.system_keys.values.include?(key)
97
96
  end
98
97
 
99
- def fail_message(key)
100
- "Cannot register key '#{key.to_s}' as already in use"
101
- end
102
-
103
- end
98
+ end # KeymapValidator
104
99
 
105
- end
100
+ end # Vedeu
@@ -95,7 +95,17 @@ module Vedeu
95
95
  def self.logger
96
96
  @logger ||= MonoLogger.new(filename).tap do |log|
97
97
  log.formatter = proc do |_, time, _, message|
98
- time.utc.iso8601 + ": " + message + "\n"
98
+ utc_time = time.utc.iso8601
99
+
100
+ if @last_seen == utc_time
101
+ message + "\n"
102
+
103
+ else
104
+ @last_seen = utc_time
105
+
106
+ "\n\e[4m\e[31m" + utc_time + "\e[39m\e[24m\n" + message + "\n"
107
+
108
+ end
99
109
  end
100
110
  end
101
111
  end
@@ -122,6 +132,6 @@ module Vedeu
122
132
  Dir.home + '/.vedeu'
123
133
  end
124
134
 
125
- end
135
+ end # Log
126
136
  # :nocov:
127
- end
137
+ end # Vedeu
@@ -157,5 +157,6 @@ module Vedeu
157
157
  @collection.size
158
158
  end
159
159
 
160
- end
161
- end
160
+ end # Menu
161
+
162
+ end # Vedeu
@@ -49,5 +49,6 @@ module Vedeu
49
49
  (@x == 0 || @x == nil) ? 1 : @x
50
50
  end
51
51
 
52
- end
53
- end
52
+ end # Position
53
+
54
+ end # Vedeu
@@ -24,8 +24,6 @@ module Vedeu
24
24
  #
25
25
  # @return [TrueClass|MissingRequired]
26
26
  def record
27
- validate_attributes!
28
-
29
27
  Vedeu::Buffers.add(attributes)
30
28
 
31
29
  Vedeu::Interfaces.add(attributes)
@@ -43,25 +41,6 @@ module Vedeu
43
41
 
44
42
  attr_reader :attributes
45
43
 
46
- # At present, validates that attributes has a `:name` key that is not nil or
47
- # empty.
48
- #
49
- # @api private
50
- # @return [TrueClass|MissingRequired]
51
- def validate_attributes!
52
- return exception unless attributes.key?(:name)
53
- return exception unless defined_value?(attributes[:name])
54
-
55
- true
56
- end
57
-
58
- # Raises the MissingRequired exception.
59
- #
60
- # @see Vedeu::MissingRequired
61
- def exception
62
- fail MissingRequired, 'Cannot store data without a name attribute.'
63
- end
64
-
65
- end
44
+ end # Registrar
66
45
 
67
- end
46
+ end # Vedeu