vedeu 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/borders_app.rb +171 -0
- data/lib/vedeu.rb +1 -1
- data/lib/vedeu/api/interface.rb +12 -0
- data/lib/vedeu/api/menu.rb +1 -1
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/models/border.rb +238 -0
- data/lib/vedeu/models/char.rb +1 -1
- data/lib/vedeu/models/composition.rb +1 -1
- data/lib/vedeu/models/geometry.rb +1 -1
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/stream.rb +1 -1
- data/lib/vedeu/output/output.rb +1 -1
- data/lib/vedeu/output/viewport.rb +34 -3
- data/lib/vedeu/repositories/models/cursor.rb +34 -7
- data/lib/vedeu/repositories/models/event.rb +1 -1
- data/lib/vedeu/repositories/models/group.rb +1 -1
- data/lib/vedeu/repositories/models/interface.rb +14 -6
- data/lib/vedeu/repositories/models/keymap.rb +1 -1
- data/lib/vedeu/repositories/models/offset.rb +1 -1
- data/lib/vedeu/support/trace.rb +1 -1
- data/test/integration/views/basic_view_test.rb +19 -0
- data/test/lib/vedeu/api/api_test.rb +6 -5
- data/test/lib/vedeu/api/helpers_test.rb +2 -6
- data/test/lib/vedeu/api/interface_test.rb +53 -45
- data/test/lib/vedeu/api/menu_test.rb +6 -0
- data/test/lib/vedeu/api/stream_test.rb +1 -3
- data/test/lib/vedeu/application_test.rb +6 -12
- data/test/lib/vedeu/colours/colour_test.rb +16 -5
- data/test/lib/vedeu/colours/translator_test.rb +7 -2
- data/test/lib/vedeu/configuration/cli_test.rb +9 -0
- data/test/lib/vedeu/input/input_test.rb +5 -5
- data/test/lib/vedeu/launcher_test.rb +9 -3
- data/test/lib/vedeu/models/border_test.rb +197 -0
- data/test/lib/vedeu/models/char_test.rb +18 -15
- data/test/lib/vedeu/models/composition_test.rb +6 -7
- data/test/lib/vedeu/models/geometry_test.rb +43 -49
- data/test/lib/vedeu/models/key_test.rb +7 -5
- data/test/lib/vedeu/models/line_test.rb +12 -16
- data/test/lib/vedeu/models/stream_test.rb +20 -10
- data/test/lib/vedeu/models/style_test.rb +9 -10
- data/test/lib/vedeu/output/compositor_test.rb +7 -22
- data/test/lib/vedeu/output/output_test.rb +34 -33
- data/test/lib/vedeu/output/viewport_test.rb +6 -6
- data/test/lib/vedeu/repositories/models/buffer_test.rb +13 -18
- data/test/lib/vedeu/repositories/models/cursor_test.rb +21 -21
- data/test/lib/vedeu/repositories/models/event_test.rb +10 -4
- data/test/lib/vedeu/{models → repositories/models}/group_test.rb +8 -9
- data/test/lib/vedeu/repositories/models/interface_test.rb +37 -17
- data/test/lib/vedeu/repositories/models/keymap_test.rb +6 -6
- data/test/lib/vedeu/repositories/models/menu_test.rb +6 -3
- data/test/lib/vedeu/repositories/models/offset_test.rb +6 -3
- data/test/lib/vedeu/support/bounding_area_test.rb +28 -36
- data/test/lib/vedeu/support/grid_test.rb +8 -0
- data/test/lib/vedeu/support/keymap_validator_test.rb +5 -8
- data/test/lib/vedeu/support/position_test.rb +3 -3
- data/test/lib/vedeu/support/registrar_test.rb +13 -7
- data/test/lib/vedeu/support/sentence_test.rb +9 -2
- data/test/lib/vedeu/support/trace_test.rb +5 -3
- data/test/test_helper.rb +12 -0
- data/vedeu.gemspec +1 -1
- metadata +8 -7
- data/lib/vedeu/output/view.rb +0 -64
- data/test/lib/vedeu/output/view_test.rb +0 -21
data/lib/vedeu/output/view.rb
DELETED
@@ -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
|