vedeu 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/examples/borders_app.rb +171 -0
  3. data/lib/vedeu.rb +1 -1
  4. data/lib/vedeu/api/interface.rb +12 -0
  5. data/lib/vedeu/api/menu.rb +1 -1
  6. data/lib/vedeu/colours/colour.rb +1 -1
  7. data/lib/vedeu/models/border.rb +238 -0
  8. data/lib/vedeu/models/char.rb +1 -1
  9. data/lib/vedeu/models/composition.rb +1 -1
  10. data/lib/vedeu/models/geometry.rb +1 -1
  11. data/lib/vedeu/models/line.rb +1 -1
  12. data/lib/vedeu/models/stream.rb +1 -1
  13. data/lib/vedeu/output/output.rb +1 -1
  14. data/lib/vedeu/output/viewport.rb +34 -3
  15. data/lib/vedeu/repositories/models/cursor.rb +34 -7
  16. data/lib/vedeu/repositories/models/event.rb +1 -1
  17. data/lib/vedeu/repositories/models/group.rb +1 -1
  18. data/lib/vedeu/repositories/models/interface.rb +14 -6
  19. data/lib/vedeu/repositories/models/keymap.rb +1 -1
  20. data/lib/vedeu/repositories/models/offset.rb +1 -1
  21. data/lib/vedeu/support/trace.rb +1 -1
  22. data/test/integration/views/basic_view_test.rb +19 -0
  23. data/test/lib/vedeu/api/api_test.rb +6 -5
  24. data/test/lib/vedeu/api/helpers_test.rb +2 -6
  25. data/test/lib/vedeu/api/interface_test.rb +53 -45
  26. data/test/lib/vedeu/api/menu_test.rb +6 -0
  27. data/test/lib/vedeu/api/stream_test.rb +1 -3
  28. data/test/lib/vedeu/application_test.rb +6 -12
  29. data/test/lib/vedeu/colours/colour_test.rb +16 -5
  30. data/test/lib/vedeu/colours/translator_test.rb +7 -2
  31. data/test/lib/vedeu/configuration/cli_test.rb +9 -0
  32. data/test/lib/vedeu/input/input_test.rb +5 -5
  33. data/test/lib/vedeu/launcher_test.rb +9 -3
  34. data/test/lib/vedeu/models/border_test.rb +197 -0
  35. data/test/lib/vedeu/models/char_test.rb +18 -15
  36. data/test/lib/vedeu/models/composition_test.rb +6 -7
  37. data/test/lib/vedeu/models/geometry_test.rb +43 -49
  38. data/test/lib/vedeu/models/key_test.rb +7 -5
  39. data/test/lib/vedeu/models/line_test.rb +12 -16
  40. data/test/lib/vedeu/models/stream_test.rb +20 -10
  41. data/test/lib/vedeu/models/style_test.rb +9 -10
  42. data/test/lib/vedeu/output/compositor_test.rb +7 -22
  43. data/test/lib/vedeu/output/output_test.rb +34 -33
  44. data/test/lib/vedeu/output/viewport_test.rb +6 -6
  45. data/test/lib/vedeu/repositories/models/buffer_test.rb +13 -18
  46. data/test/lib/vedeu/repositories/models/cursor_test.rb +21 -21
  47. data/test/lib/vedeu/repositories/models/event_test.rb +10 -4
  48. data/test/lib/vedeu/{models → repositories/models}/group_test.rb +8 -9
  49. data/test/lib/vedeu/repositories/models/interface_test.rb +37 -17
  50. data/test/lib/vedeu/repositories/models/keymap_test.rb +6 -6
  51. data/test/lib/vedeu/repositories/models/menu_test.rb +6 -3
  52. data/test/lib/vedeu/repositories/models/offset_test.rb +6 -3
  53. data/test/lib/vedeu/support/bounding_area_test.rb +28 -36
  54. data/test/lib/vedeu/support/grid_test.rb +8 -0
  55. data/test/lib/vedeu/support/keymap_validator_test.rb +5 -8
  56. data/test/lib/vedeu/support/position_test.rb +3 -3
  57. data/test/lib/vedeu/support/registrar_test.rb +13 -7
  58. data/test/lib/vedeu/support/sentence_test.rb +9 -2
  59. data/test/lib/vedeu/support/trace_test.rb +5 -3
  60. data/test/test_helper.rb +12 -0
  61. data/vedeu.gemspec +1 -1
  62. metadata +8 -7
  63. data/lib/vedeu/output/view.rb +0 -64
  64. data/test/lib/vedeu/output/view_test.rb +0 -21
@@ -1,64 +0,0 @@
1
- module Vedeu
2
-
3
- # Subclassing Vedeu::View will allow Vedeu to call your #render method.
4
- # This method should contain attributes required to build a view or views.
5
- # These attributes will be added to the back buffer of each interface
6
- # mentioned, to be rendered upon next refresh.
7
- #
8
- # @deprecated May disappear in 0.3.0. Prefer {Vedeu::API#render} instead.
9
- # @see Vedeu::API#render
10
- # @api private
11
- class View
12
-
13
- include Vedeu::API
14
-
15
- # @param object []
16
- # @return [Array]
17
- def self.render(object = nil)
18
- new(object).enqueue
19
- end
20
-
21
- # Returns a new instance of View.
22
- #
23
- # @param object []
24
- # @return [View]
25
- def initialize(object = nil)
26
- @object = object
27
- end
28
-
29
- # @return [Array]
30
- def enqueue
31
- composition.interfaces.map do |interface|
32
- Buffers.add(interface.attributes)
33
- end
34
- end
35
-
36
- # @raise [NotImplemented] Subclasses of this class must implement this
37
- # method.
38
- # @return [Exception]
39
- def render
40
- fail NotImplemented, 'Implement #render on your subclass of Vedeu::View.'
41
- end
42
-
43
- private
44
-
45
- attr_reader :object
46
-
47
- # Create a new Composition object with the attributes.
48
- #
49
- # @return [Composition]
50
- def composition
51
- @_composition ||= Composition.new(attributes)
52
- end
53
-
54
- # Calls the #render method of the subclass, hopefully receives attributes
55
- # suitable to create one or more views.
56
- #
57
- # @return []
58
- def attributes
59
- render
60
- end
61
-
62
- end # View
63
-
64
- end # Vedeu
@@ -1,21 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- class ViewTest < View
6
- def render
7
- { interfaces: [] }
8
- end
9
- end # ViewTest
10
-
11
- describe View do
12
-
13
- describe '.render' do
14
- it 'returns' do
15
- ViewTest.render.must_equal([])
16
- end
17
- end
18
-
19
- end # View
20
-
21
- end # Vedeu