vedeu 0.6.69 → 0.6.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +4 -0
  3. data/lib/vedeu/all.rb +5 -7
  4. data/lib/vedeu/borders/all.rb +1 -0
  5. data/lib/vedeu/borders/repository.rb +2 -6
  6. data/lib/vedeu/borders/set_attribute.rb +71 -0
  7. data/lib/vedeu/buffers/buffer.rb +6 -1
  8. data/lib/vedeu/buffers/refresh.rb +6 -1
  9. data/lib/vedeu/common.rb +2 -1
  10. data/lib/vedeu/configuration/configuration.rb +1 -1
  11. data/lib/vedeu/cursors/all.rb +1 -0
  12. data/lib/vedeu/cursors/cursor.rb +8 -27
  13. data/lib/vedeu/cursors/move.rb +69 -0
  14. data/lib/vedeu/cursors/repository.rb +1 -1
  15. data/lib/vedeu/dsl/all.rb +2 -0
  16. data/lib/vedeu/dsl/composition.rb +6 -1
  17. data/lib/vedeu/dsl/lines.rb +21 -0
  18. data/lib/vedeu/dsl/streams.rb +21 -0
  19. data/lib/vedeu/groups/clear.rb +6 -1
  20. data/lib/vedeu/groups/refresh.rb +6 -1
  21. data/lib/vedeu/input/capture.rb +6 -1
  22. data/lib/vedeu/interfaces/clear.rb +6 -1
  23. data/lib/vedeu/interfaces/interface.rb +20 -8
  24. data/lib/vedeu/models/all.rb +1 -0
  25. data/lib/vedeu/models/focus.rb +19 -14
  26. data/lib/vedeu/models/page.rb +5 -0
  27. data/lib/vedeu/models/row.rb +5 -0
  28. data/lib/vedeu/models/toggleable.rb +6 -1
  29. data/lib/vedeu/null/all.rb +0 -1
  30. data/lib/vedeu/output/all.rb +0 -2
  31. data/lib/vedeu/output/compressor.rb +2 -1
  32. data/lib/vedeu/output/wordwrap.rb +6 -1
  33. data/lib/vedeu/output/write.rb +2 -0
  34. data/lib/vedeu/presentation/all.rb +17 -0
  35. data/lib/vedeu/presentation/background.rb +47 -0
  36. data/lib/vedeu/presentation/colour.rb +42 -0
  37. data/lib/vedeu/presentation/foreground.rb +47 -0
  38. data/lib/vedeu/{output/presentation → presentation}/presentation.rb +0 -0
  39. data/lib/vedeu/{output/presentation → presentation}/style.rb +0 -0
  40. data/lib/vedeu/presentation/styles.rb +45 -0
  41. data/lib/vedeu/{output/renderers → renderers}/all.rb +5 -5
  42. data/lib/vedeu/{output/renderers → renderers}/file.rb +0 -0
  43. data/lib/vedeu/{output/renderers → renderers}/html.rb +0 -0
  44. data/lib/vedeu/{output/renderers → renderers}/json.rb +0 -0
  45. data/lib/vedeu/{output/renderers → renderers}/options.rb +5 -1
  46. data/lib/vedeu/{output → renderers}/templates/html_renderer.vedeu +0 -0
  47. data/lib/vedeu/{output/renderers → renderers}/terminal.rb +1 -1
  48. data/lib/vedeu/repositories/all.rb +1 -0
  49. data/lib/vedeu/repositories/parent.rb +32 -0
  50. data/lib/vedeu/repositories/repositories.rb +1 -0
  51. data/lib/vedeu/runtime/flags.rb +2 -0
  52. data/lib/vedeu/templating/view_template.rb +6 -1
  53. data/lib/vedeu/version.rb +1 -1
  54. data/lib/vedeu/views/all.rb +20 -0
  55. data/lib/vedeu/{models/views → views}/char.rb +33 -21
  56. data/lib/vedeu/views/chars.rb +15 -0
  57. data/lib/vedeu/{models/views → views}/composition.rb +0 -0
  58. data/lib/vedeu/{models/views → views}/html_char.rb +0 -0
  59. data/lib/vedeu/{models/views → views}/line.rb +17 -21
  60. data/lib/vedeu/views/lines.rb +15 -0
  61. data/lib/vedeu/{models/views → views}/stream.rb +16 -20
  62. data/lib/vedeu/views/streams.rb +15 -0
  63. data/lib/vedeu/{models/views → views}/view.rb +28 -17
  64. data/lib/vedeu/views/view_collection.rb +15 -0
  65. data/lib/vedeu.rb +2 -0
  66. data/test/lib/vedeu/borders/set_attribute_test.rb +62 -0
  67. data/test/lib/vedeu/common_test.rb +6 -0
  68. data/test/lib/vedeu/cursors/cursor_test.rb +0 -8
  69. data/test/lib/vedeu/cursors/move_test.rb +73 -0
  70. data/test/lib/vedeu/cursors/repository_test.rb +3 -1
  71. data/test/lib/vedeu/dsl/lines_test.rb +12 -0
  72. data/test/lib/vedeu/dsl/streams_test.rb +13 -0
  73. data/test/lib/vedeu/events/aliases_test.rb +4 -4
  74. data/test/lib/vedeu/groups/refresh_test.rb +0 -6
  75. data/test/lib/vedeu/input/store_test.rb +2 -2
  76. data/test/lib/vedeu/interfaces/interface_test.rb +6 -1
  77. data/test/lib/vedeu/models/focus_test.rb +25 -10
  78. data/test/lib/vedeu/models/page_test.rb +6 -0
  79. data/test/lib/vedeu/models/row_test.rb +12 -0
  80. data/test/lib/vedeu/presentation/background_test.rb +72 -0
  81. data/test/lib/vedeu/presentation/colour_test.rb +67 -0
  82. data/test/lib/vedeu/presentation/foreground_test.rb +73 -0
  83. data/test/lib/vedeu/{output/presentation → presentation}/presentation_test.rb +0 -0
  84. data/test/lib/vedeu/{output/presentation → presentation}/style_test.rb +0 -0
  85. data/test/lib/vedeu/{output/presentation → presentation}/styles_test.rb +7 -9
  86. data/test/lib/vedeu/{output/renderers → renderers}/all_test.rb +3 -2
  87. data/test/lib/vedeu/{output/renderers → renderers}/file_test.rb +0 -0
  88. data/test/lib/vedeu/{output/renderers → renderers}/html_test.rb +2 -1
  89. data/test/lib/vedeu/{output/renderers → renderers}/json_test.rb +1 -0
  90. data/test/lib/vedeu/{output/renderers → renderers}/options_test.rb +10 -6
  91. data/test/lib/vedeu/{output/renderers → renderers}/terminal_test.rb +0 -0
  92. data/test/lib/vedeu/repositories/repositories_test.rb +1 -0
  93. data/test/lib/vedeu/runtime/flags_test.rb +2 -0
  94. data/test/lib/vedeu/templating/helpers_test.rb +15 -6
  95. data/test/lib/vedeu/{models/views → views}/char_test.rb +0 -0
  96. data/test/lib/vedeu/{models/views → views}/composition_test.rb +0 -0
  97. data/test/lib/vedeu/{models/views → views}/html_char_test.rb +0 -0
  98. data/test/lib/vedeu/{models/views → views}/line_test.rb +6 -1
  99. data/test/lib/vedeu/views/lines_test.rb +13 -0
  100. data/test/lib/vedeu/{models/views → views}/stream_test.rb +6 -1
  101. data/test/lib/vedeu/views/streams_test.rb +13 -0
  102. data/test/lib/vedeu/views/view_collection_test.rb +13 -0
  103. data/test/lib/vedeu/{models/views → views}/view_test.rb +6 -1
  104. data/test/support/examples/material_colours_app.rb +1 -1
  105. data/test/support/helpers/presentation_colour_test_class.rb +29 -0
  106. data/test/test_helper.rb +4 -0
  107. metadata +84 -56
  108. data/lib/vedeu/models/views/all.rb +0 -16
  109. data/lib/vedeu/null/view.rb +0 -26
  110. data/lib/vedeu/output/presentation/all.rb +0 -15
  111. data/lib/vedeu/output/presentation/colour.rb +0 -100
  112. data/lib/vedeu/output/presentation/styles.rb +0 -42
  113. data/test/lib/vedeu/null/view_test.rb +0 -31
  114. data/test/lib/vedeu/output/presentation/colour_test.rb +0 -172
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a0211b4a6e94bd7926f99ff108861471ea89615
4
- data.tar.gz: e083d41fa583f3ef357d1814c17fe7bd36357e46
3
+ metadata.gz: 6a215a258800fb64a1c3493c3a504bfed883fc54
4
+ data.tar.gz: f6b96d7ba7a7e0b5aca5e55ef211a3afc5b50f4c
5
5
  SHA512:
6
- metadata.gz: f8c146bd737d56df2eda77f1b8d762b80da4f2321240df7d29d4a48904276b7932d5bf11b59e773822e7456c895c3ed84277075bd4d1ed6ad1b7fb03acb333f7
7
- data.tar.gz: d46ceb3d84bc7782854ca90aebc88bef0b9c397a120b5c23514e6827f860bea645f41fe751b61160acd0d9409dc7cfa0244dc163185374e339b32207eaa32629
6
+ metadata.gz: 901c2cce80b9ec3468c80c538e8c6b8b372cea78db1fae7b04cfee13bf0b457ade911966d1086b0bec8b4f04d9270ec08d0a7b9e1296aac56011fbd1e56d5b69
7
+ data.tar.gz: b747cefb06613a45addde327f5183c13cfa8d7dc0cfcf2367b6b75ebf65bd581d4f595f2bbd329ebc47739a8fe86d8e2befd9111c0e74d7af4b4d3a25ae4e8fa
data/docs/api.md CHANGED
@@ -285,6 +285,10 @@ Repository method. Access registered events.
285
285
 
286
286
  @todo Add more documentation.
287
287
 
288
+ ### Vedeu.focus?
289
+
290
+ @todo Add more documentation.
291
+
288
292
  ### Vedeu.focus_by_name
289
293
 
290
294
  @todo Add more documentation.
data/lib/vedeu/all.rb CHANGED
@@ -1,23 +1,21 @@
1
+ require 'vedeu/common'
2
+ require 'vedeu/error'
1
3
  require 'vedeu/version'
2
4
 
3
- require 'vedeu/common'
4
5
  require 'vedeu/colours/all'
5
6
  require 'vedeu/configuration/all'
6
7
  require 'vedeu/repositories/all'
7
8
  require 'vedeu/events/all'
8
9
  require 'vedeu/esc/all'
9
10
  require 'vedeu/logging/all'
10
- require 'vedeu/error'
11
11
  require 'vedeu/runtime/all'
12
12
  require 'vedeu/terminal/all'
13
-
14
- require 'vedeu/models/toggleable'
15
-
13
+ require 'vedeu/presentation/all'
16
14
  require 'vedeu/output/all'
17
-
15
+ require 'vedeu/renderers/all'
18
16
  require 'vedeu/esc/all'
19
17
  require 'vedeu/null/all'
20
- require 'vedeu/models/views/all'
18
+ require 'vedeu/views/all'
21
19
  require 'vedeu/models/all'
22
20
  require 'vedeu/application/all'
23
21
  require 'vedeu/cursors/all'
@@ -39,3 +39,4 @@ require 'vedeu/borders/border'
39
39
  require 'vedeu/borders/dsl'
40
40
  require 'vedeu/borders/refresh'
41
41
  require 'vedeu/borders/repository'
42
+ require 'vedeu/borders/set_attribute'
@@ -35,16 +35,12 @@ module Vedeu
35
35
 
36
36
  # See {file:docs/borders.md#label-3A_set_border_caption_}
37
37
  Vedeu.bind(:_set_border_caption_) do |name, caption|
38
- border = Vedeu.borders.by_name(name)
39
- border.caption = caption
40
- border.store { Vedeu.trigger(:_refresh_border_, name) }
38
+ Vedeu::Borders::SetAttribute.update(name, :title, caption)
41
39
  end
42
40
 
43
41
  # See {file:docs/borders.md#label-3A_set_border_title_}
44
42
  Vedeu.bind(:_set_border_title_) do |name, title|
45
- border = Vedeu.borders.by_name(name)
46
- border.title = title
47
- border.store { Vedeu.trigger(:_refresh_border_, name) }
43
+ Vedeu::Borders::SetAttribute.update(name, :caption, title)
48
44
  end
49
45
 
50
46
  # :nocov:
@@ -0,0 +1,71 @@
1
+ module Vedeu
2
+
3
+ module Borders
4
+
5
+ # @api private
6
+ #
7
+ class SetAttribute
8
+
9
+ include Vedeu::Common
10
+
11
+ # @param name [String|Symbol]
12
+ # @param attribute [Symbol]
13
+ # @param value [String]
14
+ # @return [Vedeu::Borders::Border]
15
+ def self.update(name, attribute, value)
16
+ new(name, attribute, value).update
17
+ end
18
+
19
+ # @param name [String|Symbol]
20
+ # @param attribute [Symbol]
21
+ # @param value [String]
22
+ # @return [Vedeu::Borders::SetAttribute]
23
+ def initialize(name, attribute, value)
24
+ @name = name
25
+ @attribute = attribute
26
+ @value = value
27
+ end
28
+
29
+ # @return [Vedeu::Borders::Border]
30
+ def update
31
+ border.send(attribute, value)
32
+ border.store { Vedeu.trigger(:_refresh_border_, name) }
33
+ border
34
+ end
35
+
36
+ protected
37
+
38
+ # @!attribute [r] name
39
+ # @return [String|Symbol] The name of the border.
40
+ attr_reader :name
41
+
42
+ private
43
+
44
+ # @return [Symbol]
45
+ def attribute
46
+ fail Vedeu::Error::MissingRequired if @attribute.nil?
47
+
48
+ (@attribute.to_s + '=').to_sym
49
+ end
50
+
51
+ # @return [Vedeu::Borders::Border]
52
+ def border
53
+ @_border ||= Vedeu.borders.by_name(name)
54
+ end
55
+
56
+ # @return [String] The new value.
57
+ def value
58
+ if present?(@value)
59
+ @value
60
+
61
+ else
62
+ ''
63
+
64
+ end
65
+ end
66
+
67
+ end # SetAttribute
68
+
69
+ end # Borders
70
+
71
+ end # Vedeu
@@ -97,7 +97,7 @@ module Vedeu
97
97
  previous.cursor_visible?
98
98
 
99
99
  else
100
- Vedeu.interfaces.by_name(name).cursor_visible?
100
+ interface.cursor_visible?
101
101
 
102
102
  end
103
103
  end
@@ -186,6 +186,11 @@ module Vedeu
186
186
  }
187
187
  end
188
188
 
189
+ # @return [Vedeu::Interfaces::Interface]
190
+ def interface
191
+ Vedeu.interfaces.by_name(name)
192
+ end
193
+
189
194
  # Return a boolean indicating content was swapped between
190
195
  # buffers.
191
196
  #
@@ -46,7 +46,7 @@ module Vedeu
46
46
  def by_name
47
47
  Vedeu.trigger(:_clear_view_content_, name)
48
48
 
49
- Vedeu.buffers.by_name(name).render
49
+ buffer.render
50
50
 
51
51
  Vedeu.trigger(:_refresh_border_, name) unless content_only?
52
52
  end
@@ -57,6 +57,11 @@ module Vedeu
57
57
  # @return [String|Symbol]
58
58
  attr_reader :name
59
59
 
60
+ # @return [Vedeu::Buffers::Buffer]
61
+ def buffer
62
+ Vedeu.buffers.by_name(name)
63
+ end
64
+
60
65
  # @return [Boolean]
61
66
  def content_only?
62
67
  options[:content_only] == true
data/lib/vedeu/common.rb CHANGED
@@ -44,7 +44,8 @@ module Vedeu
44
44
  # @return [Boolean]
45
45
  def present?(variable)
46
46
  return true if variable.is_a?(Fixnum)
47
- return true unless variable.nil? || variable.empty?
47
+ return true unless variable.nil? ||
48
+ (variable.respond_to?(:empty?) && variable.empty?)
48
49
 
49
50
  false
50
51
  end
@@ -358,7 +358,7 @@ module Vedeu
358
358
 
359
359
  end # Configuration
360
360
 
361
- require 'vedeu/output/renderers/all'
361
+ require 'vedeu/renderers/all'
362
362
 
363
363
  Vedeu::Configuration.configure({})
364
364
 
@@ -15,6 +15,7 @@ module Vedeu
15
15
 
16
16
  end # Vedeu
17
17
 
18
+ require 'vedeu/cursors/move'
18
19
  require 'vedeu/cursors/coordinate'
19
20
  require 'vedeu/cursors/cursor'
20
21
  require 'vedeu/cursors/dsl'
@@ -101,7 +101,7 @@ module Vedeu
101
101
  @oy += 1
102
102
  @y = coordinate(oy, :y).y
103
103
 
104
- store_and_refresh
104
+ self
105
105
  end
106
106
 
107
107
  # Moves the cursor left by one column.
@@ -114,7 +114,7 @@ module Vedeu
114
114
  @ox -= 1
115
115
  @x = coordinate(ox, :x).x
116
116
 
117
- store_and_refresh
117
+ self
118
118
  end
119
119
 
120
120
  # Moves the cursor to the top left of the named interface.
@@ -142,7 +142,7 @@ module Vedeu
142
142
  @ox += 1
143
143
  @x = coordinate(ox, :x).x
144
144
 
145
- store_and_refresh
145
+ self
146
146
  end
147
147
 
148
148
  # Moves the cursor up by one row.
@@ -155,7 +155,7 @@ module Vedeu
155
155
  @oy -= 1
156
156
  @y = coordinate(oy, :y).y
157
157
 
158
- store_and_refresh
158
+ self
159
159
  end
160
160
 
161
161
  # Renders the cursor.
@@ -297,17 +297,6 @@ module Vedeu
297
297
  attributes.merge!(x: new_x, y: new_y, ox: new_ox, oy: new_oy)
298
298
  end
299
299
 
300
- # Store the cursor and refresh the cursor.
301
- #
302
- # @return [void]
303
- def store_and_refresh
304
- store
305
-
306
- Vedeu.trigger(:_refresh_cursor_, name)
307
-
308
- self
309
- end
310
-
311
300
  # Returns the escape sequence for setting the visibility of the
312
301
  # cursor.
313
302
  #
@@ -348,30 +337,22 @@ module Vedeu
348
337
 
349
338
  # See {file:docs/cursors.md}
350
339
  Vedeu.bind(:_cursor_left_) do |name|
351
- Vedeu.cursors.by_name(name).tap do |cursor|
352
- cursor.move_left if cursor.visible?
353
- end
340
+ Vedeu::Cursors::Move.move(name, :move_left)
354
341
  end
355
342
 
356
343
  # See {file:docs/cursors.md}
357
344
  Vedeu.bind(:_cursor_down_) do |name|
358
- Vedeu.cursors.by_name(name).tap do |cursor|
359
- cursor.move_down if cursor.visible?
360
- end
345
+ Vedeu::Cursors::Move.move(name, :move_down)
361
346
  end
362
347
 
363
348
  # See {file:docs/cursors.md}
364
349
  Vedeu.bind(:_cursor_up_) do |name|
365
- Vedeu.cursors.by_name(name).tap do |cursor|
366
- cursor.move_up if cursor.visible?
367
- end
350
+ Vedeu::Cursors::Move.move(name, :move_up)
368
351
  end
369
352
 
370
353
  # See {file:docs/cursors.md}
371
354
  Vedeu.bind(:_cursor_right_) do |name|
372
- Vedeu.cursors.by_name(name).tap do |cursor|
373
- cursor.move_right if cursor.visible?
374
- end
355
+ Vedeu::Cursors::Move.move(name, :move_right)
375
356
  end
376
357
 
377
358
  # See {file:docs/cursors.md}
@@ -0,0 +1,69 @@
1
+ module Vedeu
2
+
3
+ module Cursors
4
+
5
+ # @api private
6
+ #
7
+ class Move
8
+
9
+ extend Forwardable
10
+
11
+ def_delegators :cursor,
12
+ :visible?
13
+
14
+ # @param name [String|Symbol]
15
+ # @param direction [Symbol]
16
+ # @return [Vedeu::Cursors::Cursor]
17
+ def self.move(name, direction)
18
+ new(name, direction).move
19
+ end
20
+
21
+ # @param name [String|Symbol]
22
+ # @param direction [Symbol]
23
+ # @return [Vedeu::Cursors::Move]
24
+ def initialize(name, direction)
25
+ @name = name
26
+ @direction = direction
27
+ end
28
+
29
+ # @return [NilClass|Vedeu::Cursors::Cursor]
30
+ def move
31
+ return nil unless visible? && valid_direction?
32
+
33
+ cursor.public_send(direction)
34
+ cursor.store { Vedeu.trigger(:_refresh_cursor_, name) }
35
+ cursor
36
+ end
37
+
38
+ protected
39
+
40
+ # @!attribute [r] name
41
+ # @return [String|Symbol] The name of the cursor.
42
+ attr_reader :name
43
+
44
+ # @!attribute [r] direction
45
+ # @return [Symbol] The direction to move the cursor.
46
+ attr_reader :direction
47
+
48
+ private
49
+
50
+ # @return [Vedeu::Cursors::Cursor]
51
+ def cursor
52
+ @_cursor ||= Vedeu.cursors.by_name(name)
53
+ end
54
+
55
+ # @return [Boolean]
56
+ def valid_direction?
57
+ [
58
+ :move_down,
59
+ :move_left,
60
+ :move_right,
61
+ :move_up,
62
+ ].include?(direction)
63
+ end
64
+
65
+ end # Move
66
+
67
+ end # Cursors
68
+
69
+ end # Vedeu
@@ -15,7 +15,7 @@ module Vedeu
15
15
  # @example
16
16
  # Vedeu.cursor
17
17
  #
18
- # @return [Vedeu::Cursors::Cursor]
18
+ # @return [NilClass|Vedeu::Cursors::Cursor]
19
19
  def cursor
20
20
  cursors.by_name
21
21
  end
data/lib/vedeu/dsl/all.rb CHANGED
@@ -14,6 +14,8 @@ require 'vedeu/dsl/use'
14
14
  require 'vedeu/dsl/presentation'
15
15
  require 'vedeu/dsl/composition'
16
16
  require 'vedeu/dsl/text'
17
+ require 'vedeu/dsl/lines'
17
18
  require 'vedeu/dsl/line'
19
+ require 'vedeu/dsl/streams'
18
20
  require 'vedeu/dsl/stream'
19
21
  require 'vedeu/dsl/view'
@@ -135,7 +135,12 @@ module Vedeu
135
135
  # @param name [String|Symbol] The name of the interface.
136
136
  # @return [Hash<Symbol => void>]
137
137
  def existing_attributes(name)
138
- Vedeu.interfaces.by_name(name).attributes
138
+ interface(name).attributes
139
+ end
140
+
141
+ # @return [Vedeu::Interfaces::Interface]
142
+ def interface(name)
143
+ Vedeu.interfaces.by_name(name)
139
144
  end
140
145
 
141
146
  end # Composition
@@ -0,0 +1,21 @@
1
+ module Vedeu
2
+
3
+ module DSL
4
+
5
+ class Lines
6
+
7
+ # @raise [Vedeu::Error::RequiresBlock]
8
+ # @return [Vedeu::Views::Lines]
9
+ # def lines(&block)
10
+ # fail Vedeu::Error::RequiresBlock unless block_given?
11
+
12
+ # client = eval('self', block.binding)
13
+
14
+ # # Vedeu::Models::Lines.new
15
+ # end
16
+
17
+ end # Lines
18
+
19
+ end # DSL
20
+
21
+ end # Vedeu
@@ -0,0 +1,21 @@
1
+ module Vedeu
2
+
3
+ module DSL
4
+
5
+ class Streams
6
+
7
+ # @raise [Vedeu::Error::RequiresBlock]
8
+ # @return [Vedeu::Views::Streams]
9
+ # def streams(&block)
10
+ # fail Vedeu::Error::RequiresBlock unless block_given?
11
+
12
+ # client = eval('self', block.binding)
13
+
14
+ # # Vedeu::Models::Stream.new
15
+ # end
16
+
17
+ end # Streams
18
+
19
+ end # DSL
20
+
21
+ end # Vedeu
@@ -45,9 +45,14 @@ module Vedeu
45
45
 
46
46
  private
47
47
 
48
+ # @return [Vedeu::Groups::Group]
49
+ def group
50
+ Vedeu.groups.by_name(name)
51
+ end
52
+
48
53
  # @return [Array<String>]
49
54
  def members
50
- Vedeu.groups.by_name(name).members
55
+ group.members
51
56
  end
52
57
 
53
58
  end # Clear
@@ -63,7 +63,12 @@ module Vedeu
63
63
 
64
64
  # @return [String|Symbol]
65
65
  def group_from_interface
66
- @_group_name ||= Vedeu.interfaces.by_name(name).group
66
+ @_group_name ||= interface.group
67
+ end
68
+
69
+ # @return [Vedeu::Interfaces::Interface]
70
+ def interface
71
+ Vedeu.interfaces.by_name(name)
67
72
  end
68
73
 
69
74
  end # Refresh
@@ -60,7 +60,7 @@ module Vedeu
60
60
  elsif Vedeu::Input::Mapper.registered?(@key, name)
61
61
  Vedeu.trigger(:_keypress_, @key, name)
62
62
 
63
- elsif Vedeu.interfaces.by_name(name).editable?
63
+ elsif interface.editable?
64
64
  Vedeu.trigger(:_editor_, @key)
65
65
 
66
66
  elsif @key.nil?
@@ -98,6 +98,11 @@ module Vedeu
98
98
  keys
99
99
  end
100
100
 
101
+ # @return [Vedeu::Interfaces::Interface]
102
+ def interface
103
+ Vedeu.interfaces.by_name(name)
104
+ end
105
+
101
106
  # Returns a boolean indicating whether a mouse click was
102
107
  # received.
103
108
  #
@@ -88,7 +88,7 @@ module Vedeu
88
88
 
89
89
  # @return [Vedeu::Colours::Colour]
90
90
  def colour
91
- @colour ||= Vedeu.interfaces.by_name(name).colour
91
+ @colour ||= interface.colour
92
92
  end
93
93
 
94
94
  # @return [Boolean]
@@ -127,6 +127,11 @@ module Vedeu
127
127
  end
128
128
  end
129
129
 
130
+ # @return [Vedeu::Interfaces::Interface]
131
+ def interface
132
+ Vedeu.interfaces.by_name(name)
133
+ end
134
+
130
135
  # @return [Hash<Symbol => Boolean>]
131
136
  def options
132
137
  defaults.merge!(@options)
@@ -11,10 +11,6 @@ module Vedeu
11
11
  include Vedeu::Presentation
12
12
  include Vedeu::Toggleable
13
13
 
14
- # @!attribute [r] attributes
15
- # @return [Hash]
16
- attr_reader :attributes
17
-
18
14
  # @!attribute [rw] client
19
15
  # @return [Fixnum|Float]
20
16
  attr_accessor :client
@@ -65,13 +61,29 @@ module Vedeu
65
61
  # @option attributes zindex [Fixnum]
66
62
  # @return [Vedeu::Interfaces::Interface]
67
63
  def initialize(attributes = {})
68
- @attributes = defaults.merge!(attributes)
69
-
70
- @attributes.each do |key, value|
64
+ defaults.merge!(attributes).each do |key, value|
71
65
  instance_variable_set("@#{key}", value)
72
66
  end
73
67
  end
74
68
 
69
+ # @return [Hash<Symbol => void>]
70
+ def attributes
71
+ {
72
+ client: client,
73
+ colour: colour,
74
+ cursor_visible: cursor_visible,
75
+ delay: delay,
76
+ editable: editable,
77
+ group: group,
78
+ name: name,
79
+ parent: parent,
80
+ repository: repository,
81
+ style: style,
82
+ visible: visible,
83
+ zindex: zindex,
84
+ }
85
+ end
86
+
75
87
  # Returns a DSL instance responsible for defining the DSL
76
88
  # methods of this model.
77
89
  #
@@ -128,7 +140,7 @@ module Vedeu
128
140
 
129
141
  # The default values for a new instance of this class.
130
142
  #
131
- # @return [Hash]
143
+ # @return [Hash<Symbol => void>]
132
144
  def defaults
133
145
  {
134
146
  client: nil,
@@ -8,6 +8,7 @@ module Vedeu
8
8
 
9
9
  end # Vedeu
10
10
 
11
+ require 'vedeu/models/toggleable'
11
12
  require 'vedeu/models/cell'
12
13
  require 'vedeu/models/escape'
13
14
  require 'vedeu/models/focus'