vedeu 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/bin/vedeu +0 -3
  3. data/examples/borders_app.rb +0 -3
  4. data/examples/colours_app.rb +0 -3
  5. data/examples/configuration_app.rb +0 -3
  6. data/examples/cursor_app.rb +0 -3
  7. data/examples/focus_app.rb +0 -3
  8. data/examples/geometry_app.rb +0 -3
  9. data/examples/lines_app.rb +0 -3
  10. data/examples/view_templates_app/template.erb +1 -0
  11. data/examples/view_templates_app/view_templates_app.rb +82 -0
  12. data/lib/vedeu/all.rb +0 -1
  13. data/lib/vedeu/application.rb +7 -6
  14. data/lib/vedeu/bindings.rb +8 -8
  15. data/lib/vedeu/buffers/buffer.rb +14 -4
  16. data/lib/vedeu/buffers/display_buffer.rb +2 -2
  17. data/lib/vedeu/configuration/cli.rb +7 -1
  18. data/lib/vedeu/configuration/configuration.rb +4 -2
  19. data/lib/vedeu/cursor/all.rb +1 -1
  20. data/lib/vedeu/cursor/cursor.rb +29 -2
  21. data/lib/vedeu/cursor/move_cursor.rb +20 -6
  22. data/lib/vedeu/cursor/toggle_cursor.rb +2 -0
  23. data/lib/vedeu/distributed/client.rb +2 -0
  24. data/lib/vedeu/distributed/server.rb +3 -1
  25. data/lib/vedeu/distributed/subprocess.rb +6 -1
  26. data/lib/vedeu/distributed/test_application.rb +32 -9
  27. data/lib/vedeu/distributed/uri.rb +7 -1
  28. data/lib/vedeu/dsl/components/border.rb +2 -0
  29. data/lib/vedeu/dsl/components/geometry.rb +2 -0
  30. data/lib/vedeu/dsl/components/keymap.rb +2 -0
  31. data/lib/vedeu/dsl/components/menu.rb +3 -1
  32. data/lib/vedeu/dsl/composition.rb +31 -2
  33. data/lib/vedeu/dsl/group.rb +2 -0
  34. data/lib/vedeu/dsl/interface.rb +3 -1
  35. data/lib/vedeu/dsl/line.rb +2 -0
  36. data/lib/vedeu/dsl/shared/style.rb +1 -1
  37. data/lib/vedeu/dsl/shared/text.rb +1 -2
  38. data/lib/vedeu/dsl/stream.rb +2 -0
  39. data/lib/vedeu/dsl/view.rb +1 -1
  40. data/lib/vedeu/events/all.rb +1 -1
  41. data/lib/vedeu/events/event.rb +26 -10
  42. data/lib/vedeu/events/trigger.rb +11 -3
  43. data/lib/vedeu/geometry/all.rb +2 -0
  44. data/lib/vedeu/geometry/bounding_area.rb +7 -2
  45. data/lib/vedeu/geometry/content_geometry.rb +2 -0
  46. data/lib/vedeu/geometry/coordinate.rb +15 -6
  47. data/lib/vedeu/geometry/grid.rb +3 -1
  48. data/lib/vedeu/geometry/index_position.rb +77 -0
  49. data/lib/vedeu/geometry/limit.rb +15 -1
  50. data/lib/vedeu/geometry/position.rb +7 -2
  51. data/lib/vedeu/{output → geometry}/position_index.rb +12 -2
  52. data/lib/vedeu/geometry/position_validator.rb +9 -1
  53. data/lib/vedeu/input/all.rb +0 -1
  54. data/lib/vedeu/input/input.rb +2 -0
  55. data/lib/vedeu/input/keymap.rb +5 -3
  56. data/lib/vedeu/input/mapper.rb +7 -1
  57. data/lib/vedeu/launcher.rb +1 -1
  58. data/lib/vedeu/models/all.rb +6 -3
  59. data/lib/vedeu/models/char.rb +157 -0
  60. data/lib/vedeu/models/{view/composition.rb → composition.rb} +1 -4
  61. data/lib/vedeu/models/geometry.rb +36 -12
  62. data/lib/vedeu/models/group.rb +7 -3
  63. data/lib/vedeu/models/{view/interface.rb → interface.rb} +26 -10
  64. data/lib/vedeu/models/{view/line.rb → line.rb} +8 -4
  65. data/lib/vedeu/models/menu.rb +11 -3
  66. data/lib/vedeu/models/{view/stream.rb → stream.rb} +9 -4
  67. data/lib/vedeu/output/all.rb +3 -2
  68. data/lib/vedeu/output/background.rb +2 -2
  69. data/lib/vedeu/output/border.rb +65 -22
  70. data/lib/vedeu/output/char_builder.rb +36 -0
  71. data/lib/vedeu/output/clear.rb +62 -0
  72. data/lib/vedeu/output/colour.rb +15 -7
  73. data/lib/vedeu/output/compositor.rb +3 -1
  74. data/lib/vedeu/output/esc.rb +2 -2
  75. data/lib/vedeu/output/foreground.rb +2 -2
  76. data/lib/vedeu/output/html_char.rb +2 -0
  77. data/lib/vedeu/output/html_renderer.rb +6 -3
  78. data/lib/vedeu/output/output.rb +20 -92
  79. data/lib/vedeu/output/presentation.rb +21 -21
  80. data/lib/vedeu/output/renderer.rb +2 -0
  81. data/lib/vedeu/output/style.rb +4 -2
  82. data/lib/vedeu/output/text.rb +7 -1
  83. data/lib/vedeu/output/translator.rb +4 -2
  84. data/lib/vedeu/output/viewport.rb +4 -2
  85. data/lib/vedeu/output/virtual_buffer.rb +11 -1
  86. data/lib/vedeu/output/virtual_terminal.rb +34 -11
  87. data/lib/vedeu/output/wordwrap.rb +31 -20
  88. data/lib/vedeu/repositories/all.rb +3 -0
  89. data/lib/vedeu/repositories/collection.rb +83 -0
  90. data/lib/vedeu/repositories/collections.rb +35 -0
  91. data/lib/vedeu/{models → repositories}/model.rb +2 -0
  92. data/lib/vedeu/repositories/repository.rb +7 -1
  93. data/lib/vedeu/support/log.rb +1 -1
  94. data/lib/vedeu/support/sentence.rb +7 -1
  95. data/lib/vedeu/support/template.rb +14 -2
  96. data/lib/vedeu/support/terminal.rb +6 -6
  97. data/lib/vedeu/support/trace.rb +4 -4
  98. data/lib/vedeu/support/visible.rb +4 -4
  99. data/test/lib/vedeu/dsl/composition_test.rb +23 -0
  100. data/test/lib/vedeu/geometry/index_position_test.rb +121 -0
  101. data/test/lib/vedeu/{output → geometry}/position_index_test.rb +6 -0
  102. data/test/lib/vedeu/input/keymap_test.rb +2 -2
  103. data/test/lib/vedeu/models/{view/char_test.rb → char_test.rb} +31 -15
  104. data/test/lib/vedeu/models/{view/composition_test.rb → composition_test.rb} +0 -0
  105. data/test/lib/vedeu/models/{view/interface_test.rb → interface_test.rb} +0 -0
  106. data/test/lib/vedeu/models/line_test.rb +156 -0
  107. data/test/lib/vedeu/models/{view/stream_test.rb → stream_test.rb} +1 -16
  108. data/test/lib/vedeu/output/char_builder_test.rb +50 -0
  109. data/test/lib/vedeu/output/clear_test.rb +26 -0
  110. data/test/lib/vedeu/output/compositor_test.rb +0 -10
  111. data/test/lib/vedeu/output/html_renderer_test.rb +8 -3
  112. data/test/lib/vedeu/output/output_test.rb +0 -39
  113. data/test/lib/vedeu/output/viewport_test.rb +10 -66
  114. data/test/lib/vedeu/output/virtual_buffer_test.rb +18 -2
  115. data/test/lib/vedeu/output/virtual_terminal_test.rb +3 -14
  116. data/test/lib/vedeu/output/wordwrap_test.rb +8 -15
  117. data/test/lib/vedeu/repositories/collection_test.rb +108 -0
  118. data/test/lib/vedeu/repositories/collections_test.rb +71 -0
  119. data/test/lib/vedeu/{models → repositories}/model_test.rb +0 -0
  120. data/test/lib/vedeu/support/template_test.rb +21 -1
  121. data/test/support/helpers/model_test_class.rb +1 -1
  122. data/test/test_helper.rb +0 -1
  123. data/vedeu.gemspec +1 -1
  124. metadata +40 -44
  125. data/lib/vedeu/events/events.rb +0 -10
  126. data/lib/vedeu/input/keys.rb +0 -10
  127. data/lib/vedeu/models/collection.rb +0 -81
  128. data/lib/vedeu/models/view/all.rb +0 -12
  129. data/lib/vedeu/models/view/char.rb +0 -99
  130. data/lib/vedeu/models/view/chars.rb +0 -10
  131. data/lib/vedeu/models/view/interfaces.rb +0 -10
  132. data/lib/vedeu/models/view/lines.rb +0 -10
  133. data/lib/vedeu/models/view/streams.rb +0 -10
  134. data/lib/vedeu/output/index_position.rb +0 -35
  135. data/test/lib/vedeu/models/collection_test.rb +0 -112
  136. data/test/lib/vedeu/models/view/chars_test.rb +0 -16
  137. data/test/lib/vedeu/models/view/interfaces_test.rb +0 -16
  138. data/test/lib/vedeu/models/view/line_test.rb +0 -214
  139. data/test/lib/vedeu/models/view/lines_test.rb +0 -16
  140. data/test/lib/vedeu/models/view/streams_test.rb +0 -16
  141. data/test/lib/vedeu/output/index_position_test.rb +0 -64
@@ -0,0 +1,108 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ describe Collection do
6
+
7
+ let(:described) { Collection }
8
+ let(:instance) { described.new(collection, parent, model_name) }
9
+ let(:collection) { [] }
10
+ let(:model_name) { 'elements' }
11
+ let(:parent) { Vedeu::ModelTestClass.new }
12
+
13
+ describe '#initialize' do
14
+ it { instance.must_be_instance_of(Collection) }
15
+ it { instance.instance_variable_get('@collection').must_equal([]) }
16
+ it { instance.instance_variable_get('@name').must_equal(model_name) }
17
+ it { instance.instance_variable_get('@parent').must_equal(parent) }
18
+ end
19
+
20
+ describe '#[]' do
21
+ let(:collection) { [:hydrogen, :helium, :lithium, :beryllium] }
22
+ let(:value) { 1..2 }
23
+
24
+ subject { instance[value] }
25
+
26
+ it { subject.must_be_instance_of(Array) }
27
+ it { subject.must_equal([:helium, :lithium]) }
28
+ end
29
+
30
+ describe '#add' do
31
+ subject { instance.add(:hydrogen) }
32
+
33
+ it { subject.must_be_instance_of(Collection) }
34
+ it { subject.all.must_equal([:hydrogen]) }
35
+
36
+ context 'with multiple objects' do
37
+ subject { instance.add(:hydrogen, :helium) }
38
+
39
+ it 'adds all the objects to the collection' do
40
+ subject.all.must_equal([:hydrogen, :helium])
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#all' do
46
+ subject { instance.all }
47
+
48
+ it { subject.must_be_instance_of(Array) }
49
+ it { subject.must_equal([]) }
50
+
51
+ context 'when the collection is not empty' do
52
+ before { instance.add(:hydrogen) }
53
+
54
+ it 'returns the populated collection' do
55
+ subject.must_equal([:hydrogen])
56
+ end
57
+ end
58
+ end
59
+
60
+ describe '#empty?' do
61
+ subject { instance.empty? }
62
+
63
+ context 'when the collection is empty' do
64
+ it { subject.must_be_instance_of(TrueClass) }
65
+ end
66
+
67
+ context 'when the collection is not empty' do
68
+ before { instance.add(:hydrogen) }
69
+
70
+ it { subject.must_be_instance_of(FalseClass) }
71
+ end
72
+ end
73
+
74
+ describe '#size' do
75
+ subject { instance.size }
76
+
77
+ it { subject.must_be_instance_of(Fixnum) }
78
+
79
+ context 'when the collection is empty' do
80
+ it { subject.must_equal(0) }
81
+ end
82
+
83
+ context 'when the collection is not empty' do
84
+ before { instance.add(:hydrogen) }
85
+
86
+ it { subject.must_equal(1) }
87
+ end
88
+ end
89
+
90
+ describe '#to_s' do
91
+ subject { instance.to_s }
92
+
93
+ it { subject.must_be_instance_of(String) }
94
+
95
+ context 'when the collection is empty' do
96
+ it { subject.must_equal('') }
97
+ end
98
+
99
+ context 'when the collection is not empty' do
100
+ before { instance.add(:hydrogen) }
101
+
102
+ it { subject.must_equal('hydrogen') }
103
+ end
104
+ end
105
+
106
+ end # Collection
107
+
108
+ end # Vedeu
@@ -0,0 +1,71 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ describe Chars do
6
+
7
+ let(:described) { Vedeu::Chars }
8
+ let(:instance) { described.new }
9
+
10
+ describe '#initialize' do
11
+ it { instance.must_be_instance_of(Vedeu::Chars) }
12
+ end
13
+
14
+ end # Chars
15
+
16
+ describe Events do
17
+
18
+ let(:described) { Vedeu::Events }
19
+ let(:instance) { described.new }
20
+
21
+ describe '#initialize' do
22
+ it { instance.must_be_instance_of(Vedeu::Events) }
23
+ end
24
+
25
+ end # Events
26
+
27
+ describe Interfaces do
28
+
29
+ let(:described) { Vedeu::Interfaces }
30
+ let(:instance) { described.new }
31
+
32
+ describe '#initialize' do
33
+ it { instance.must_be_instance_of(Vedeu::Interfaces) }
34
+ end
35
+
36
+ end # Interfaces
37
+
38
+ describe Keys do
39
+
40
+ let(:described) { Vedeu::Keys }
41
+ let(:instance) { described.new }
42
+
43
+ describe '#initialize' do
44
+ it { instance.must_be_instance_of(Vedeu::Keys) }
45
+ end
46
+
47
+ end # Keys
48
+
49
+ describe Lines do
50
+
51
+ let(:described) { Vedeu::Lines }
52
+ let(:instance) { described.new }
53
+
54
+ describe '#initialize' do
55
+ it { instance.must_be_instance_of(Vedeu::Lines) }
56
+ end
57
+
58
+ end # Lines
59
+
60
+ describe Streams do
61
+
62
+ let(:described) { Vedeu::Streams }
63
+ let(:instance) { described.new }
64
+
65
+ describe '#initialize' do
66
+ it { instance.must_be_instance_of(Vedeu::Streams) }
67
+ end
68
+
69
+ end # Streams
70
+
71
+ end # Vedeu
@@ -12,11 +12,31 @@ module Vedeu
12
12
  describe '#initialize' do
13
13
  it { instance.must_be_instance_of(Vedeu::Template) }
14
14
  it { instance.instance_variable_get('@object').must_equal(object) }
15
- it { instance.instance_variable_get('@path').must_equal(path) }
15
+ it { instance.instance_variable_get('@path').must_equal('') }
16
16
  end
17
17
 
18
18
  describe '.parse' do
19
19
  subject { described.parse(object, path) }
20
+
21
+ before { File.stubs(:read).returns('') }
22
+
23
+ context 'when the path is empty' do
24
+ it { proc { subject }.must_raise(MissingRequired) }
25
+ end
26
+
27
+ context 'when the path is does not exist' do
28
+ let(:path) { '/tmp/vedeu_does_not_exist' }
29
+
30
+ it { proc { subject }.must_raise(MissingRequired) }
31
+ end
32
+
33
+ context 'when the path exists' do
34
+ let(:path) { '/tmp/vedeu_does_exist' }
35
+
36
+ before { File.stubs(:exist?).returns(true) }
37
+
38
+ it { subject.must_equal('') }
39
+ end
20
40
  end
21
41
 
22
42
  end # Template
@@ -1,4 +1,4 @@
1
- require 'vedeu/models/model'
1
+ require 'vedeu/repositories/model'
2
2
  require 'vedeu/output/presentation'
3
3
 
4
4
  module Vedeu
data/test/test_helper.rb CHANGED
@@ -18,7 +18,6 @@ SimpleCov.start do
18
18
  add_group 'dsl', 'vedeu/dsl'
19
19
  add_group 'events', 'vedeu/events'
20
20
  add_group 'input', 'vedeu/input'
21
- add_group 'models/view', 'vedeu/models/view'
22
21
  add_group 'models', 'vedeu/models'
23
22
  add_group 'output', 'vedeu/output'
24
23
  add_group 'presentation', 'vedeu/presentation'
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.5'
7
+ spec.version = '0.4.6'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-07 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -301,6 +301,8 @@ files:
301
301
  - examples/geometry_app.rb
302
302
  - examples/hello_world.rb
303
303
  - examples/lines_app.rb
304
+ - examples/view_templates_app/template.erb
305
+ - examples/view_templates_app/view_templates_app.rb
304
306
  - features/start_stop.feature
305
307
  - features/support/env.rb
306
308
  - inch.yml
@@ -355,7 +357,6 @@ files:
355
357
  - lib/vedeu/dsl/view.rb
356
358
  - lib/vedeu/events/all.rb
357
359
  - lib/vedeu/events/event.rb
358
- - lib/vedeu/events/events.rb
359
360
  - lib/vedeu/events/trigger.rb
360
361
  - lib/vedeu/exceptions.rb
361
362
  - lib/vedeu/geometry/all.rb
@@ -363,46 +364,40 @@ files:
363
364
  - lib/vedeu/geometry/content_geometry.rb
364
365
  - lib/vedeu/geometry/coordinate.rb
365
366
  - lib/vedeu/geometry/grid.rb
367
+ - lib/vedeu/geometry/index_position.rb
366
368
  - lib/vedeu/geometry/limit.rb
367
369
  - lib/vedeu/geometry/position.rb
370
+ - lib/vedeu/geometry/position_index.rb
368
371
  - lib/vedeu/geometry/position_validator.rb
369
372
  - lib/vedeu/input/all.rb
370
373
  - lib/vedeu/input/input.rb
371
374
  - lib/vedeu/input/key.rb
372
375
  - lib/vedeu/input/keymap.rb
373
- - lib/vedeu/input/keys.rb
374
376
  - lib/vedeu/input/mapper.rb
375
377
  - lib/vedeu/launcher.rb
376
378
  - lib/vedeu/main_loop.rb
377
379
  - lib/vedeu/models/all.rb
378
- - lib/vedeu/models/collection.rb
380
+ - lib/vedeu/models/char.rb
381
+ - lib/vedeu/models/composition.rb
379
382
  - lib/vedeu/models/focus.rb
380
383
  - lib/vedeu/models/geometry.rb
381
384
  - lib/vedeu/models/group.rb
385
+ - lib/vedeu/models/interface.rb
386
+ - lib/vedeu/models/line.rb
382
387
  - lib/vedeu/models/menu.rb
383
- - lib/vedeu/models/model.rb
384
- - lib/vedeu/models/view/all.rb
385
- - lib/vedeu/models/view/char.rb
386
- - lib/vedeu/models/view/chars.rb
387
- - lib/vedeu/models/view/composition.rb
388
- - lib/vedeu/models/view/interface.rb
389
- - lib/vedeu/models/view/interfaces.rb
390
- - lib/vedeu/models/view/line.rb
391
- - lib/vedeu/models/view/lines.rb
392
- - lib/vedeu/models/view/stream.rb
393
- - lib/vedeu/models/view/streams.rb
388
+ - lib/vedeu/models/stream.rb
394
389
  - lib/vedeu/output/all.rb
395
390
  - lib/vedeu/output/background.rb
396
391
  - lib/vedeu/output/border.rb
392
+ - lib/vedeu/output/char_builder.rb
393
+ - lib/vedeu/output/clear.rb
397
394
  - lib/vedeu/output/colour.rb
398
395
  - lib/vedeu/output/compositor.rb
399
396
  - lib/vedeu/output/esc.rb
400
397
  - lib/vedeu/output/foreground.rb
401
398
  - lib/vedeu/output/html_char.rb
402
399
  - lib/vedeu/output/html_renderer.rb
403
- - lib/vedeu/output/index_position.rb
404
400
  - lib/vedeu/output/output.rb
405
- - lib/vedeu/output/position_index.rb
406
401
  - lib/vedeu/output/presentation.rb
407
402
  - lib/vedeu/output/refresh.rb
408
403
  - lib/vedeu/output/renderer.rb
@@ -415,6 +410,9 @@ files:
415
410
  - lib/vedeu/output/virtual_terminal.rb
416
411
  - lib/vedeu/output/wordwrap.rb
417
412
  - lib/vedeu/repositories/all.rb
413
+ - lib/vedeu/repositories/collection.rb
414
+ - lib/vedeu/repositories/collections.rb
415
+ - lib/vedeu/repositories/model.rb
418
416
  - lib/vedeu/repositories/repository.rb
419
417
  - lib/vedeu/support/all.rb
420
418
  - lib/vedeu/support/coercions.rb
@@ -463,7 +461,9 @@ files:
463
461
  - test/lib/vedeu/geometry/content_geometry_test.rb
464
462
  - test/lib/vedeu/geometry/coordinate_test.rb
465
463
  - test/lib/vedeu/geometry/grid_test.rb
464
+ - test/lib/vedeu/geometry/index_position_test.rb
466
465
  - test/lib/vedeu/geometry/limit_test.rb
466
+ - test/lib/vedeu/geometry/position_index_test.rb
467
467
  - test/lib/vedeu/geometry/position_test.rb
468
468
  - test/lib/vedeu/geometry/position_validator_test.rb
469
469
  - test/lib/vedeu/input/input_test.rb
@@ -472,32 +472,26 @@ files:
472
472
  - test/lib/vedeu/input/mapper_test.rb
473
473
  - test/lib/vedeu/launcher_test.rb
474
474
  - test/lib/vedeu/main_loop_test.rb
475
- - test/lib/vedeu/models/collection_test.rb
475
+ - test/lib/vedeu/models/char_test.rb
476
+ - test/lib/vedeu/models/composition_test.rb
476
477
  - test/lib/vedeu/models/focus_test.rb
477
478
  - test/lib/vedeu/models/geometry_test.rb
478
479
  - test/lib/vedeu/models/group_test.rb
480
+ - test/lib/vedeu/models/interface_test.rb
481
+ - test/lib/vedeu/models/line_test.rb
479
482
  - test/lib/vedeu/models/menu_test.rb
480
- - test/lib/vedeu/models/model_test.rb
481
- - test/lib/vedeu/models/view/char_test.rb
482
- - test/lib/vedeu/models/view/chars_test.rb
483
- - test/lib/vedeu/models/view/composition_test.rb
484
- - test/lib/vedeu/models/view/interface_test.rb
485
- - test/lib/vedeu/models/view/interfaces_test.rb
486
- - test/lib/vedeu/models/view/line_test.rb
487
- - test/lib/vedeu/models/view/lines_test.rb
488
- - test/lib/vedeu/models/view/stream_test.rb
489
- - test/lib/vedeu/models/view/streams_test.rb
483
+ - test/lib/vedeu/models/stream_test.rb
490
484
  - test/lib/vedeu/output/background_test.rb
491
485
  - test/lib/vedeu/output/border_test.rb
486
+ - test/lib/vedeu/output/char_builder_test.rb
487
+ - test/lib/vedeu/output/clear_test.rb
492
488
  - test/lib/vedeu/output/colour_test.rb
493
489
  - test/lib/vedeu/output/compositor_test.rb
494
490
  - test/lib/vedeu/output/esc_test.rb
495
491
  - test/lib/vedeu/output/foreground_test.rb
496
492
  - test/lib/vedeu/output/html_char_test.rb
497
493
  - test/lib/vedeu/output/html_renderer_test.rb
498
- - test/lib/vedeu/output/index_position_test.rb
499
494
  - test/lib/vedeu/output/output_test.rb
500
- - test/lib/vedeu/output/position_index_test.rb
501
495
  - test/lib/vedeu/output/presentation_test.rb
502
496
  - test/lib/vedeu/output/refresh_test.rb
503
497
  - test/lib/vedeu/output/renderer_test.rb
@@ -509,6 +503,9 @@ files:
509
503
  - test/lib/vedeu/output/virtual_terminal_test.rb
510
504
  - test/lib/vedeu/output/wordwrap_test.rb
511
505
  - test/lib/vedeu/repositories/all_test.rb
506
+ - test/lib/vedeu/repositories/collection_test.rb
507
+ - test/lib/vedeu/repositories/collections_test.rb
508
+ - test/lib/vedeu/repositories/model_test.rb
512
509
  - test/lib/vedeu/repositories/repository_test.rb
513
510
  - test/lib/vedeu/support/coercions_test.rb
514
511
  - test/lib/vedeu/support/common_test.rb
@@ -593,7 +590,9 @@ test_files:
593
590
  - test/lib/vedeu/geometry/content_geometry_test.rb
594
591
  - test/lib/vedeu/geometry/coordinate_test.rb
595
592
  - test/lib/vedeu/geometry/grid_test.rb
593
+ - test/lib/vedeu/geometry/index_position_test.rb
596
594
  - test/lib/vedeu/geometry/limit_test.rb
595
+ - test/lib/vedeu/geometry/position_index_test.rb
597
596
  - test/lib/vedeu/geometry/position_test.rb
598
597
  - test/lib/vedeu/geometry/position_validator_test.rb
599
598
  - test/lib/vedeu/input/input_test.rb
@@ -602,32 +601,26 @@ test_files:
602
601
  - test/lib/vedeu/input/mapper_test.rb
603
602
  - test/lib/vedeu/launcher_test.rb
604
603
  - test/lib/vedeu/main_loop_test.rb
605
- - test/lib/vedeu/models/collection_test.rb
604
+ - test/lib/vedeu/models/char_test.rb
605
+ - test/lib/vedeu/models/composition_test.rb
606
606
  - test/lib/vedeu/models/focus_test.rb
607
607
  - test/lib/vedeu/models/geometry_test.rb
608
608
  - test/lib/vedeu/models/group_test.rb
609
+ - test/lib/vedeu/models/interface_test.rb
610
+ - test/lib/vedeu/models/line_test.rb
609
611
  - test/lib/vedeu/models/menu_test.rb
610
- - test/lib/vedeu/models/model_test.rb
611
- - test/lib/vedeu/models/view/char_test.rb
612
- - test/lib/vedeu/models/view/chars_test.rb
613
- - test/lib/vedeu/models/view/composition_test.rb
614
- - test/lib/vedeu/models/view/interface_test.rb
615
- - test/lib/vedeu/models/view/interfaces_test.rb
616
- - test/lib/vedeu/models/view/line_test.rb
617
- - test/lib/vedeu/models/view/lines_test.rb
618
- - test/lib/vedeu/models/view/stream_test.rb
619
- - test/lib/vedeu/models/view/streams_test.rb
612
+ - test/lib/vedeu/models/stream_test.rb
620
613
  - test/lib/vedeu/output/background_test.rb
621
614
  - test/lib/vedeu/output/border_test.rb
615
+ - test/lib/vedeu/output/char_builder_test.rb
616
+ - test/lib/vedeu/output/clear_test.rb
622
617
  - test/lib/vedeu/output/colour_test.rb
623
618
  - test/lib/vedeu/output/compositor_test.rb
624
619
  - test/lib/vedeu/output/esc_test.rb
625
620
  - test/lib/vedeu/output/foreground_test.rb
626
621
  - test/lib/vedeu/output/html_char_test.rb
627
622
  - test/lib/vedeu/output/html_renderer_test.rb
628
- - test/lib/vedeu/output/index_position_test.rb
629
623
  - test/lib/vedeu/output/output_test.rb
630
- - test/lib/vedeu/output/position_index_test.rb
631
624
  - test/lib/vedeu/output/presentation_test.rb
632
625
  - test/lib/vedeu/output/refresh_test.rb
633
626
  - test/lib/vedeu/output/renderer_test.rb
@@ -639,6 +632,9 @@ test_files:
639
632
  - test/lib/vedeu/output/virtual_terminal_test.rb
640
633
  - test/lib/vedeu/output/wordwrap_test.rb
641
634
  - test/lib/vedeu/repositories/all_test.rb
635
+ - test/lib/vedeu/repositories/collection_test.rb
636
+ - test/lib/vedeu/repositories/collections_test.rb
637
+ - test/lib/vedeu/repositories/model_test.rb
642
638
  - test/lib/vedeu/repositories/repository_test.rb
643
639
  - test/lib/vedeu/support/coercions_test.rb
644
640
  - test/lib/vedeu/support/common_test.rb
@@ -1,10 +0,0 @@
1
- require 'vedeu/models/collection'
2
-
3
- module Vedeu
4
-
5
- # A collection of {Vedeu::Event} instances.
6
- #
7
- class Events < Vedeu::Model::Collection
8
- end # Events
9
-
10
- end # Vedeu
@@ -1,10 +0,0 @@
1
- require 'vedeu/models/collection'
2
-
3
- module Vedeu
4
-
5
- # A collection of {Vedeu::Key} instances.
6
- #
7
- class Keys < Vedeu::Model::Collection
8
- end # Keys
9
-
10
- end # Vedeu
@@ -1,81 +0,0 @@
1
- module Vedeu
2
-
3
- module Model
4
-
5
- # Convert an Array into an object which has some meaning in the context it
6
- # is being used.
7
- #
8
- class Collection
9
-
10
- include Enumerable
11
-
12
- attr_accessor :parent, :name
13
-
14
- # @param collection [Array|Vedeu::Model::Collection]
15
- # @param parent []
16
- # @param name [String|NilClass]
17
- # @return [Vedeu::Model::Collection]
18
- def self.coerce(collection = [], parent = nil, name = nil)
19
- if collection.kind_of?(Vedeu::Model::Collection)
20
- collection
21
-
22
- else
23
- new(Array(collection), parent, name)
24
-
25
- end
26
- end
27
-
28
- # @param collection []
29
- # @param parent []
30
- # @param name []
31
- # @return [Vedeu::Model::Collection]
32
- def initialize(collection = [], parent = nil, name = nil)
33
- @collection = collection
34
- @parent = parent
35
- @name = name
36
- end
37
-
38
- # @param value [Fixnum]
39
- # @return [void]
40
- def [](value)
41
- @collection[value]
42
- end
43
-
44
- # @param other [Vedeu::Model::Collection]
45
- # @return [Vedeu::Model::Collection]
46
- def add(*other)
47
- self.class.new(@collection += other, parent, name)
48
- end
49
- alias_method :<<, :add
50
-
51
- # @return [Array]
52
- def all
53
- @collection
54
- end
55
-
56
- # @param block [Proc]
57
- # @return [Enumerator]
58
- def each(&block)
59
- @collection.each(&block)
60
- end
61
-
62
- # @return [Boolean]
63
- def empty?
64
- @collection.empty?
65
- end
66
-
67
- # @return [Fixnum]
68
- def size
69
- @collection.size
70
- end
71
-
72
- # @return [String]
73
- def to_s
74
- @collection.map(&:to_s).join
75
- end
76
-
77
- end # Collection
78
-
79
- end # Model
80
-
81
- end # Vedeu
@@ -1,12 +0,0 @@
1
- require 'vedeu/models/view/chars'
2
- require 'vedeu/models/view/char'
3
- require 'vedeu/models/view/composition'
4
- require 'vedeu/models/view/interfaces'
5
- require 'vedeu/models/view/interface'
6
- require 'vedeu/models/view/lines'
7
- require 'vedeu/models/view/line'
8
- require 'vedeu/models/view/streams'
9
- require 'vedeu/models/view/stream'
10
-
11
- module Vedeu
12
- end # Vedeu
@@ -1,99 +0,0 @@
1
- require 'vedeu/output/html_char'
2
- require 'vedeu/output/presentation'
3
-
4
- module Vedeu
5
-
6
- # A Char represents a single character of the terminal. It is a container for
7
- # the a single character in a {Vedeu::Stream}.
8
- #
9
- # Though a multi-character String can be passed as a value, only the first
10
- # character is returned in the escape sequence.
11
- #
12
- class Char
13
-
14
- include Vedeu::Presentation
15
-
16
- attr_accessor :border,
17
- :parent
18
-
19
- attr_reader :value
20
-
21
- # Returns a new instance of Char.
22
- #
23
- # @param attributes [Hash]
24
- # @option attributes value [String]
25
- # @option attributes parent [Line]
26
- # @option attributes colour [Colour]
27
- # @option attributes style [Style]
28
- # @option attributes position [Position]
29
- # @option attributes border [Boolean]
30
- # @return [Char]
31
- def initialize(attributes = {})
32
- @attributes = defaults.merge!(attributes)
33
-
34
- @border = @attributes[:border]
35
- @colour = @attributes[:colour]
36
- @parent = @attributes[:parent]
37
- @style = @attributes[:style]
38
- @value = @attributes[:value]
39
- end
40
-
41
- # @param other []
42
- # @return [Boolean]
43
- def ==(other)
44
- eql?(other)
45
- end
46
-
47
- # @param other []
48
- # @return [Boolean]
49
- def eql?(other)
50
- self.class == other.class && value == other.value
51
- end
52
-
53
- # @return [Vedeu::Position]
54
- def position
55
- @position ||= Vedeu::Position.coerce(attributes[:position])
56
- end
57
-
58
- # @param value [Vedeu::Position]
59
- # @return [Vedeu::Position]
60
- def position=(value)
61
- @position = Vedeu::Position.coerce(value)
62
- end
63
-
64
- # @return [Fixnum|NilClass]
65
- def x
66
- position.x if position
67
- end
68
-
69
- # @return [Fixnum|NilClass]
70
- def y
71
- position.y if position
72
- end
73
-
74
- # @return [String]
75
- def to_html
76
- @to_html ||= HTMLChar.render(self)
77
- end
78
-
79
- private
80
-
81
- attr_reader :attributes
82
-
83
- # The default values for a new instance of this class.
84
- #
85
- # @return [Hash]
86
- def defaults
87
- {
88
- border: nil,
89
- colour: nil,
90
- parent: nil,
91
- position: nil,
92
- style: nil,
93
- value: '',
94
- }
95
- end
96
-
97
- end # Char
98
-
99
- end # Vedeu
@@ -1,10 +0,0 @@
1
- require 'vedeu/models/collection'
2
-
3
- module Vedeu
4
-
5
- # A collection of {Vedeu::Char} instances.
6
- #
7
- class Chars < Vedeu::Model::Collection
8
- end # Chars
9
-
10
- end # Vedeu