vedeu 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/all.rb +2 -13
  3. data/lib/vedeu/api.rb +9 -9
  4. data/lib/vedeu/application/application_view.rb +3 -5
  5. data/lib/vedeu/bindings/bindings.rb +5 -1
  6. data/lib/vedeu/bindings/focus.rb +0 -5
  7. data/lib/vedeu/bindings/refresh.rb +0 -5
  8. data/lib/vedeu/bindings/system.rb +1 -6
  9. data/lib/vedeu/colours/all.rb +17 -0
  10. data/lib/vedeu/colours/background.rb +32 -28
  11. data/lib/vedeu/colours/backgrounds.rb +13 -9
  12. data/lib/vedeu/colours/colour.rb +106 -102
  13. data/lib/vedeu/colours/foreground.rb +32 -28
  14. data/lib/vedeu/colours/foregrounds.rb +13 -9
  15. data/lib/vedeu/colours/repository.rb +70 -0
  16. data/lib/vedeu/colours/translator.rb +267 -0
  17. data/lib/vedeu/configuration/api.rb +10 -7
  18. data/lib/vedeu/configuration/configuration.rb +2 -1
  19. data/lib/vedeu/dsl/border.rb +15 -2
  20. data/lib/vedeu/dsl/composition.rb +6 -4
  21. data/lib/vedeu/dsl/geometry.rb +14 -7
  22. data/lib/vedeu/dsl/group.rb +2 -2
  23. data/lib/vedeu/dsl/interface.rb +5 -3
  24. data/lib/vedeu/dsl/keymap.rb +9 -7
  25. data/lib/vedeu/dsl/line.rb +7 -4
  26. data/lib/vedeu/dsl/menu.rb +3 -0
  27. data/lib/vedeu/dsl/presentation.rb +20 -10
  28. data/lib/vedeu/dsl/shared.rb +4 -4
  29. data/lib/vedeu/dsl/stream.rb +2 -2
  30. data/lib/vedeu/dsl/text.rb +11 -5
  31. data/lib/vedeu/dsl/use.rb +2 -2
  32. data/lib/vedeu/dsl/view.rb +8 -6
  33. data/lib/vedeu/events/aliases.rb +91 -0
  34. data/lib/vedeu/events/all.rb +15 -0
  35. data/lib/vedeu/events/collection.rb +13 -0
  36. data/lib/vedeu/events/event.rb +244 -239
  37. data/lib/vedeu/events/repository.rb +30 -0
  38. data/lib/vedeu/events/trigger.rb +68 -64
  39. data/lib/vedeu/exceptions.rb +65 -54
  40. data/lib/vedeu/geometry/coordinate.rb +3 -1
  41. data/lib/vedeu/geometry/grid.rb +2 -4
  42. data/lib/vedeu/input/editor/all.rb +2 -1
  43. data/lib/vedeu/input/editor/{virtual_cursor.rb → cursor.rb} +10 -10
  44. data/lib/vedeu/input/editor/document.rb +7 -7
  45. data/lib/vedeu/input/editor/insert.rb +70 -0
  46. data/lib/vedeu/input/editor/line.rb +4 -16
  47. data/lib/vedeu/input/editor/lines.rb +2 -16
  48. data/lib/vedeu/input/input_translator.rb +2 -2
  49. data/lib/vedeu/input/key.rb +2 -2
  50. data/lib/vedeu/internal_api.rb +6 -6
  51. data/lib/vedeu/log/lockless_log_device.rb +0 -74
  52. data/lib/vedeu/models/focus.rb +3 -3
  53. data/lib/vedeu/models/interface.rb +3 -3
  54. data/lib/vedeu/models/menu.rb +2 -2
  55. data/lib/vedeu/models/views/char.rb +1 -1
  56. data/lib/vedeu/models/views/composition.rb +1 -1
  57. data/lib/vedeu/models/views/line.rb +1 -1
  58. data/lib/vedeu/models/views/stream.rb +1 -1
  59. data/lib/vedeu/models/views/view.rb +6 -7
  60. data/lib/vedeu/output/presentation/colour.rb +23 -21
  61. data/lib/vedeu/output/renderers/renderer_options.rb +2 -4
  62. data/lib/vedeu/output/text.rb +1 -1
  63. data/lib/vedeu/output/wordwrap.rb +18 -7
  64. data/lib/vedeu/plugins/plugin.rb +2 -2
  65. data/lib/vedeu/refresh/refresh_buffer.rb +3 -3
  66. data/lib/vedeu/refresh/refresh_group.rb +3 -3
  67. data/lib/vedeu/repositories/repository.rb +7 -6
  68. data/lib/vedeu/runtime/application.rb +1 -1
  69. data/lib/vedeu/runtime/main_loop.rb +3 -3
  70. data/lib/vedeu/runtime/router.rb +14 -11
  71. data/lib/vedeu/templating/helpers.rb +5 -5
  72. data/lib/vedeu/templating/template.rb +4 -4
  73. data/lib/vedeu/templating/view_template.rb +1 -1
  74. data/lib/vedeu/terminal/terminal.rb +2 -2
  75. data/lib/vedeu/version.rb +1 -1
  76. data/test/lib/vedeu/application/application_view_test.rb +1 -1
  77. data/test/lib/vedeu/colours/background_test.rb +93 -89
  78. data/test/lib/vedeu/colours/backgrounds_test.rb +11 -7
  79. data/test/lib/vedeu/colours/colour_test.rb +155 -151
  80. data/test/lib/vedeu/colours/foreground_test.rb +93 -89
  81. data/test/lib/vedeu/colours/foregrounds_test.rb +11 -7
  82. data/test/lib/vedeu/colours/repository_test.rb +97 -0
  83. data/test/lib/vedeu/colours/translator_test.rb +173 -0
  84. data/test/lib/vedeu/configuration/api_test.rb +4 -4
  85. data/test/lib/vedeu/dsl/border_test.rb +12 -0
  86. data/test/lib/vedeu/dsl/composition_test.rb +3 -3
  87. data/test/lib/vedeu/dsl/geometry_test.rb +11 -0
  88. data/test/lib/vedeu/dsl/group_test.rb +2 -2
  89. data/test/lib/vedeu/dsl/interface_test.rb +4 -4
  90. data/test/lib/vedeu/dsl/keymap_test.rb +8 -4
  91. data/test/lib/vedeu/dsl/line_test.rb +6 -3
  92. data/test/lib/vedeu/dsl/menu_test.rb +6 -0
  93. data/test/lib/vedeu/dsl/presentation_test.rb +16 -3
  94. data/test/lib/vedeu/dsl/stream_test.rb +1 -1
  95. data/test/lib/vedeu/dsl/text_test.rb +7 -0
  96. data/test/lib/vedeu/dsl/view_test.rb +3 -3
  97. data/test/lib/vedeu/events/aliases_test.rb +144 -0
  98. data/test/lib/vedeu/events/collection_test.rb +22 -0
  99. data/test/lib/vedeu/events/event_test.rb +84 -80
  100. data/test/lib/vedeu/events/repository_test.rb +28 -0
  101. data/test/lib/vedeu/events/trigger_test.rb +41 -37
  102. data/test/lib/vedeu/geometry/grid_test.rb +4 -4
  103. data/test/lib/vedeu/input/editor/{virtual_cursor_test.rb → cursor_test.rb} +3 -3
  104. data/test/lib/vedeu/input/editor/insert_test.rb +36 -0
  105. data/test/lib/vedeu/input/key_test.rb +1 -1
  106. data/test/lib/vedeu/models/cell_test.rb +1 -1
  107. data/test/lib/vedeu/models/focus_test.rb +4 -2
  108. data/test/lib/vedeu/models/menu_test.rb +1 -1
  109. data/test/lib/vedeu/models/views/char_test.rb +8 -4
  110. data/test/lib/vedeu/models/views/line_test.rb +4 -4
  111. data/test/lib/vedeu/models/views/stream_test.rb +3 -3
  112. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  113. data/test/lib/vedeu/output/html_char_test.rb +4 -2
  114. data/test/lib/vedeu/output/presentation/colour_test.rb +5 -5
  115. data/test/lib/vedeu/output/presentation_test.rb +4 -4
  116. data/test/lib/vedeu/output/renderers/json_test.rb +4 -2
  117. data/test/lib/vedeu/plugins/plugin_test.rb +1 -1
  118. data/test/lib/vedeu/refresh/refresh_buffer_test.rb +1 -1
  119. data/test/lib/vedeu/refresh/refresh_group_test.rb +1 -1
  120. data/test/lib/vedeu/repositories/repository_test.rb +2 -2
  121. data/test/lib/vedeu/runtime/router_test.rb +6 -6
  122. data/test/lib/vedeu/templating/decoder_test.rb +2 -3
  123. data/test/lib/vedeu/templating/encoder_test.rb +2 -3
  124. data/test/lib/vedeu/templating/helpers_test.rb +6 -6
  125. data/test/lib/vedeu/templating/template_test.rb +2 -2
  126. data/test/lib/vedeu/templating/view_template_test.rb +13 -7
  127. data/test/lib/vedeu/terminal/terminal_test.rb +3 -3
  128. metadata +24 -19
  129. data/lib/vedeu/colours/colour_translator.rb +0 -260
  130. data/lib/vedeu/colours/colours.rb +0 -66
  131. data/lib/vedeu/events/event_aliases.rb +0 -87
  132. data/lib/vedeu/events/event_collection.rb +0 -9
  133. data/lib/vedeu/events/events.rb +0 -26
  134. data/test/lib/vedeu/colours/colour_translator_test.rb +0 -169
  135. data/test/lib/vedeu/colours/colours_test.rb +0 -93
  136. data/test/lib/vedeu/events/event_aliases_test.rb +0 -140
  137. data/test/lib/vedeu/events/event_collection_test.rb +0 -18
  138. data/test/lib/vedeu/events/events_test.rb +0 -24
@@ -65,7 +65,8 @@ module Vedeu
65
65
  # @option opts stdout [File|IO]
66
66
  # @option opts stderr [File|IO]
67
67
  # @param block [Proc]
68
- # @raise [Vedeu::InvalidSyntax] When the required block is not given.
68
+ # @raise [Vedeu::Error::InvalidSyntax]
69
+ # When the required block is not given.
69
70
  # @return [Hash]
70
71
  def configure(args = [], opts = {}, &block)
71
72
  instance.configure(args, opts, &block)
@@ -41,10 +41,11 @@ module Vedeu
41
41
  # @param name [String] The name of the interface or view to which this
42
42
  # border belongs.
43
43
  # @param block [Proc]
44
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
44
+ # @raise [Vedeu::Error::InvalidSyntax]
45
+ # The required block was not given.
45
46
  # @return [Vedeu::Border]
46
47
  def self.border(name, &block)
47
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
48
+ fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given?
48
49
 
49
50
  Vedeu::Border.build(enabled: true, name: name, &block).store
50
51
  end
@@ -73,6 +74,7 @@ module Vedeu
73
74
  def bottom_left(char)
74
75
  model.bottom_left = char
75
76
  end
77
+ alias_method :bottom_left=, :bottom_left
76
78
 
77
79
  # Set the character to be used to draw the bottom right corner of the
78
80
  # border.
@@ -88,6 +90,7 @@ module Vedeu
88
90
  def bottom_right(char)
89
91
  model.bottom_right = char
90
92
  end
93
+ alias_method :bottom_right=, :bottom_right
91
94
 
92
95
  # Disable the border:
93
96
  #
@@ -141,6 +144,7 @@ module Vedeu
141
144
  def horizontal(char)
142
145
  model.horizontal = char
143
146
  end
147
+ alias_method :horizontal=, :horizontal
144
148
 
145
149
  # Enable/disable the bottom border.
146
150
  #
@@ -161,6 +165,7 @@ module Vedeu
161
165
  model.show_bottom = boolean
162
166
  end
163
167
  alias_method :show_bottom, :bottom
168
+ alias_method :bottom=, :bottom
164
169
 
165
170
  # Disable the bottom border.
166
171
  #
@@ -195,6 +200,7 @@ module Vedeu
195
200
  model.show_left = boolean
196
201
  end
197
202
  alias_method :show_left, :left
203
+ alias_method :left=, :left
198
204
 
199
205
  # Disable the left border.
200
206
  #
@@ -229,6 +235,7 @@ module Vedeu
229
235
  model.show_right = boolean
230
236
  end
231
237
  alias_method :show_right, :right
238
+ alias_method :right=, :right
232
239
 
233
240
  # Disable the right border.
234
241
  #
@@ -260,6 +267,7 @@ module Vedeu
260
267
  def title(value)
261
268
  model.title = value
262
269
  end
270
+ alias_method :title=, :title
263
271
 
264
272
  # If you have you are showing a bottom border, you could add a caption.
265
273
  #
@@ -277,6 +285,7 @@ module Vedeu
277
285
  def caption(value)
278
286
  model.caption = value
279
287
  end
288
+ alias_method :caption=, :caption
280
289
 
281
290
  # Enable/disable the top border.
282
291
  #
@@ -297,6 +306,7 @@ module Vedeu
297
306
  model.show_top = boolean
298
307
  end
299
308
  alias_method :show_top, :top
309
+ alias_method :top=, :top
300
310
 
301
311
  # Disable the top border.
302
312
  #
@@ -325,6 +335,7 @@ module Vedeu
325
335
  def top_left(char)
326
336
  model.top_left = char
327
337
  end
338
+ alias_method :top_left=, :top_left
328
339
 
329
340
  # Set the character to be used to draw the top right corner of the border.
330
341
  #
@@ -339,6 +350,7 @@ module Vedeu
339
350
  def top_right(char)
340
351
  model.top_right = char
341
352
  end
353
+ alias_method :top_right=, :top_right
342
354
 
343
355
  # Set the character to be used to draw a vertical part of the border.
344
356
  #
@@ -353,6 +365,7 @@ module Vedeu
353
365
  def vertical(char)
354
366
  model.vertical = char
355
367
  end
368
+ alias_method :vertical=, :vertical
356
369
 
357
370
  end # Border
358
371
 
@@ -68,10 +68,11 @@ module Vedeu
68
68
  # # ...
69
69
  # end
70
70
  #
71
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
71
+ # @raise [Vedeu::Error::InvalidSyntax]
72
+ # The required block was not given.
72
73
  # @return [Vedeu::Views::Views<Vedeu::Views::View>]
73
74
  def view(name = '', &block)
74
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
75
+ fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given?
75
76
 
76
77
  new_model = model.member.build(new_attributes(name), &block)
77
78
 
@@ -97,11 +98,12 @@ module Vedeu
97
98
  # @param object [Object] The object for which the values of template's
98
99
  # variables can be obtained.
99
100
  # @param options [Hash] See {Vedeu::Wordwrap}
101
+ # @raise [Vedeu::Error::MissingRequired]
100
102
  # @return [Vedeu::Views::Views<Vedeu::Views::View>]
101
103
  def template_for(name, filename, object = nil, options = {})
102
- fail Vedeu::MissingRequired,
104
+ fail Vedeu::Error::MissingRequired,
103
105
  'Cannot render template without the name of the view.' unless name
104
- fail Vedeu::MissingRequired,
106
+ fail Vedeu::Error::MissingRequired,
105
107
  'Cannot render template without a filename.' unless filename
106
108
 
107
109
  options.merge!(name: name)
@@ -82,10 +82,10 @@ module Vedeu
82
82
  # @param name [String] The name of the interface or view to which this
83
83
  # geometry belongs.
84
84
  # @param block [Proc]
85
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
85
+ # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
86
86
  # @return [Vedeu::Geometry]
87
87
  def self.geometry(name, &block)
88
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
88
+ fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given?
89
89
 
90
90
  Vedeu::Geometry.build(name: name, &block).store
91
91
  end
@@ -120,6 +120,7 @@ module Vedeu
120
120
  model.centred = boolean
121
121
  end
122
122
  alias_method :centred!, :centred
123
+ alias_method :centred=, :centred
123
124
 
124
125
  # Returns the width in characters for the number of columns specified.
125
126
  #
@@ -132,9 +133,9 @@ module Vedeu
132
133
  # end
133
134
  #
134
135
  # @param value [Fixnum]
135
- # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
136
- # 12 inclusive.
137
- # @return [Fixnum|Vedeu::OutOfRange]
136
+ # @raise [Vedeu::Error::OutOfRange] When the value parameter is not
137
+ # between 1 and 12 inclusive.
138
+ # @return [Fixnum|Vedeu::Error::OutOfRange]
138
139
  def columns(value)
139
140
  Vedeu::Grid.columns(value)
140
141
  end
@@ -152,6 +153,7 @@ module Vedeu
152
153
  def height(value)
153
154
  model.height = proc { value }
154
155
  end
156
+ alias_method :height=, :height
155
157
 
156
158
  # Returns the height in characters for the number of rows specified.
157
159
  #
@@ -164,8 +166,8 @@ module Vedeu
164
166
  # end
165
167
  #
166
168
  # @param value [Fixnum]
167
- # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
168
- # 12 inclusive.
169
+ # @raise [Vedeu::Error::OutOfRange] When the value parameter is not
170
+ # between 1 and 12 inclusive.
169
171
  # @return [Fixnum]
170
172
  def rows(value)
171
173
  Vedeu::Grid.rows(value)
@@ -184,6 +186,7 @@ module Vedeu
184
186
  def width(value)
185
187
  model.width = proc { value }
186
188
  end
189
+ alias_method :width=, :width
187
190
 
188
191
  # Specify the starting x position (column) of the interface.
189
192
  #
@@ -203,6 +206,7 @@ module Vedeu
203
206
 
204
207
  model.x = value
205
208
  end
209
+ alias_method :x=, :x
206
210
 
207
211
  # Specify the ending x position (column) of the interface.
208
212
  # This value will override `width`.
@@ -223,6 +227,7 @@ module Vedeu
223
227
 
224
228
  model.xn = value
225
229
  end
230
+ alias_method :xn=, :xn
226
231
 
227
232
  # Specify the starting y position (row/line) of the interface.
228
233
  #
@@ -242,6 +247,7 @@ module Vedeu
242
247
 
243
248
  model.y = value
244
249
  end
250
+ alias_method :y=, :y
245
251
 
246
252
  # Specify the ending y position (row/line) of the interface.
247
253
  # This value will override `height`.
@@ -261,6 +267,7 @@ module Vedeu
261
267
 
262
268
  model.yn = value
263
269
  end
270
+ alias_method :yn=, :yn
264
271
 
265
272
  end # Geometry
266
273
 
@@ -50,10 +50,10 @@ module Vedeu
50
50
  #
51
51
  # @param name [String] The name of this group.
52
52
  # @param block [Proc]
53
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
53
+ # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
54
54
  # @return [Vedeu::Group]
55
55
  def self.group(name, &block)
56
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
56
+ fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given?
57
57
 
58
58
  Vedeu::Group.build(name: name, &block).store
59
59
  end
@@ -29,12 +29,14 @@ module Vedeu
29
29
  # interface throughout your application's execution lifetime.
30
30
  # @param block [Proc] A set of attributes which define the features of
31
31
  # the interface.
32
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
32
+ # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
33
33
  # @return [Vedeu::Interface]
34
34
  # @todo More documentation required.
35
35
  def interface(name, &block)
36
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
37
- fail Vedeu::MissingRequired, 'name not given' unless present?(name)
36
+ fail Vedeu::Error::InvalidSyntax,
37
+ 'block not given' unless block_given?
38
+ fail Vedeu::Error::MissingRequired,
39
+ 'name not given' unless present?(name)
38
40
 
39
41
  add_buffers!(name)
40
42
  add_cursor!(name)
@@ -47,7 +47,7 @@ module Vedeu
47
47
  # @param name [String] The name of the interface which this keymap relates
48
48
  # to.
49
49
  # @param block [Proc]
50
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
50
+ # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
51
51
  # @return [Vedeu::Keymap]
52
52
  # @todo Try to remember why we need to pre-create the keymap in the
53
53
  # repository.
@@ -75,27 +75,28 @@ module Vedeu
75
75
  # extras are treated as aliases.
76
76
  # @param block [Proc] The action to perform when this key is pressed. Can
77
77
  # be a method call or event triggered.
78
- # @raise [Vedeu::InvalidSyntax] When the required block is not given, the
79
- # value_or_values parameter is undefined, or when processing the
80
- # collection, a member is undefined.
78
+ # @raise [Vedeu::Error::InvalidSyntax]
79
+ # When the required block is not given, the value_or_values parameter is
80
+ # undefined, or when processing the collection, a member is undefined.
81
81
  # @return [Array] A collection containing the keypress(es).
82
82
  def key(*value_or_values, &block)
83
- fail Vedeu::InvalidSyntax,
83
+ fail Vedeu::Error::InvalidSyntax,
84
84
  'No action defined for `key`.' unless block_given?
85
85
 
86
86
  unless present?(value_or_values)
87
- fail Vedeu::InvalidSyntax, 'No keypress(es) defined for `key`.'
87
+ fail Vedeu::Error::InvalidSyntax, 'No keypress(es) defined for `key`.'
88
88
  end
89
89
 
90
90
  value_or_values.each do |value|
91
91
  unless present?(value)
92
- fail Vedeu::InvalidSyntax,
92
+ fail Vedeu::Error::InvalidSyntax,
93
93
  'An invalid value for `key` was encountered.'
94
94
  end
95
95
 
96
96
  model.add(model.member.new(value, &block))
97
97
  end
98
98
  end
99
+ alias_method :key=, :key
99
100
 
100
101
  # Define the name of the keymap.
101
102
  #
@@ -115,6 +116,7 @@ module Vedeu
115
116
  def name(value)
116
117
  model.name = value
117
118
  end
119
+ alias_method :name=, :name
118
120
 
119
121
  end # Keymap
120
122
 
@@ -59,7 +59,7 @@ module Vedeu
59
59
  # end
60
60
  # end
61
61
  #
62
- # @raise [Vedeu::InvalidSyntax] When no block or value is provided.
62
+ # @raise [Vedeu::Error::InvalidSyntax] When no block or value is provided.
63
63
  # @return [Vedeu::Views::Lines]
64
64
  def line(value = '', &block)
65
65
  if block_given?
@@ -72,12 +72,13 @@ module Vedeu
72
72
  value: [build_stream(value)])
73
73
 
74
74
  else
75
- fail Vedeu::InvalidSyntax, 'block not given'
75
+ fail Vedeu::Error::InvalidSyntax, 'block not given'
76
76
 
77
77
  end
78
78
 
79
79
  model.parent.add(content)
80
80
  end
81
+ alias_method :line=, :line
81
82
 
82
83
  # Define multiple streams (a stream is a subset of a line).
83
84
  # Uses {Vedeu::DSL::Stream} for all directives within the required block.
@@ -97,15 +98,17 @@ module Vedeu
97
98
  # end
98
99
  #
99
100
  # @param block [Proc]
100
- # @raise [Vedeu::InvalidSyntax] The required block was not given.
101
+ # @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
101
102
  # @return [Vedeu::Views::Streams<Vedeu::Views::Stream>]
102
103
  # @see Vedeu::DSL::Stream for subdirectives.
103
104
  def streams(&block)
104
- fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
105
+ fail Vedeu::Error::InvalidSyntax, 'block not given' unless block_given?
105
106
 
106
107
  model.add(model.member.build(attributes, &block))
107
108
  end
108
109
  alias_method :stream, :streams
110
+ alias_method :stream=, :streams
111
+ alias_method :streams=, :streams
109
112
 
110
113
  private
111
114
 
@@ -32,6 +32,7 @@ module Vedeu
32
32
  def item(element)
33
33
  model.collection << element
34
34
  end
35
+ alias_method :item=, :item
35
36
 
36
37
  # Define the items for the menu. Most powerful when used with one of your
37
38
  # model classes.
@@ -53,6 +54,7 @@ module Vedeu
53
54
  def items(collection = [])
54
55
  model.collection = collection
55
56
  end
57
+ alias_method :items=, :items
56
58
 
57
59
  # The name of the menu. Used to reference the menu throughout your
58
60
  # application's execution lifetime.
@@ -67,6 +69,7 @@ module Vedeu
67
69
  def name(value)
68
70
  model.name = value
69
71
  end
72
+ alias_method :name=, :name
70
73
 
71
74
  end # Menu
72
75
 
@@ -37,17 +37,23 @@ module Vedeu
37
37
  #
38
38
  # @return [String]
39
39
  def background(value = '')
40
- colour(background: Vedeu::Background.coerce(value))
40
+ colour(background: Vedeu::Colours::Background.coerce(value))
41
41
  end
42
- alias_method :bg, :background
43
- alias_method :bgcolor, :background
42
+ alias_method :bg, :background
43
+ alias_method :bgcolor, :background
44
+ alias_method :background=, :background
45
+ alias_method :bg=, :background
46
+ alias_method :bgcolor=, :background
44
47
 
45
48
  # @see Vedeu::DSL::Presentation#background
46
49
  def foreground(value = '')
47
- colour(foreground: Vedeu::Foreground.coerce(value))
50
+ colour(foreground: Vedeu::Colours::Foreground.coerce(value))
48
51
  end
49
- alias_method :fg, :foreground
50
- alias_method :fgcolor, :foreground
52
+ alias_method :fg, :foreground
53
+ alias_method :fgcolor, :foreground
54
+ alias_method :foreground=, :foreground
55
+ alias_method :fg=, :foreground
56
+ alias_method :fgcolor=, :foreground
51
57
 
52
58
  # Define either or both foreground and background colours for an
53
59
  # interface, line or a stream. At least one attribute is required.
@@ -56,7 +62,7 @@ module Vedeu
56
62
  # defined colour for a particular interface, line or stream overrides
57
63
  # previously defined entries in the same block.
58
64
  #
59
- # @param attrs [Hash] See {Vedeu::Colour}
65
+ # @param attrs [Hash] See {Vedeu::Colours::Colour}
60
66
  #
61
67
  # @example
62
68
  # interface 'my_interface' do
@@ -74,10 +80,12 @@ module Vedeu
74
80
  # end
75
81
  # end
76
82
  #
77
- # @return [Vedeu::Colour]
83
+ # @return [Vedeu::Colours::Colour]
78
84
  def colour(attrs = {})
79
- model.colour = Vedeu::Colour.coerce(colour_attributes.merge!(attrs))
85
+ model.colour = Vedeu::Colours::Colour
86
+ .coerce(colour_attributes.merge!(attrs))
80
87
  end
88
+ alias_method :colour=, :colour
81
89
 
82
90
  # Define a style or styles for an interface, line or a stream.
83
91
  #
@@ -103,7 +111,9 @@ module Vedeu
103
111
  def style(value)
104
112
  model.style = Vedeu::Style.coerce(value)
105
113
  end
106
- alias_method :styles, :style
114
+ alias_method :style=, :style
115
+ alias_method :styles, :style
116
+ alias_method :styles=, :style
107
117
 
108
118
  private
109
119