vedeu 0.6.58 → 0.6.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vedeu/buffers/empty.rb +3 -20
- data/lib/vedeu/buffers/view.rb +1 -10
- data/lib/vedeu/editor/document.rb +3 -21
- data/lib/vedeu/geometry/all.rb +0 -1
- data/lib/vedeu/geometry/move.rb +5 -20
- data/lib/vedeu/geometry/repository.rb +1 -1
- data/lib/vedeu/models/cell.rb +2 -21
- data/lib/vedeu/repositories/all.rb +1 -0
- data/lib/vedeu/repositories/defaults.rb +33 -0
- data/lib/vedeu/repositories/registerable.rb +4 -2
- data/lib/vedeu/repositories/repository.rb +11 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/repositories/defaults_test.rb +15 -0
- data/test/lib/vedeu/repositories/registerable_test.rb +2 -0
- data/test/support/examples/material_colours_app.rb +33 -27
- metadata +5 -5
- data/lib/vedeu/geometry/null.rb +0 -66
- data/test/lib/vedeu/geometry/null_test.rb +0 -72
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5813addb77c651976f42073bc53aab1b4af606a
|
|
4
|
+
data.tar.gz: 3cb787a6bb92c95ef9a883eced3c6452afdccf8b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b55242a13ddc309b76455ccb9938abf0f2c517f448b82a43f885cede2e82616c2b6c9419f80f48b7283f4fcda220cc3d5eb1b31b74e719ebb751d1d9f7ed4849
|
|
7
|
+
data.tar.gz: e8005cd4ff555b0a51cfbbba53401cf2040291382c6b87f7687c1553c97a9c24f6eb6f308c2d4df106c5e2a5b728b7c36e93599bdc61eb3cded59be34e77dfc2
|
data/lib/vedeu/buffers/empty.rb
CHANGED
|
@@ -8,29 +8,12 @@ module Vedeu
|
|
|
8
8
|
# @api private
|
|
9
9
|
class Empty
|
|
10
10
|
|
|
11
|
+
include Vedeu::Repositories::Defaults
|
|
12
|
+
|
|
11
13
|
# @!attribute [r] name
|
|
12
14
|
# @return [NilClass|String|Symbol]
|
|
13
15
|
attr_reader :name
|
|
14
16
|
|
|
15
|
-
# Returns a new instance of Vedeu::Buffers::Empty.
|
|
16
|
-
#
|
|
17
|
-
# @note
|
|
18
|
-
# If a particular key is missing from the attributes
|
|
19
|
-
# parameter, then it is added with the respective value from
|
|
20
|
-
# #defaults.
|
|
21
|
-
#
|
|
22
|
-
# @param attributes [Hash<Symbol => Fixnum, NilClass, String,
|
|
23
|
-
# Symbol]
|
|
24
|
-
# @option attributes name [NilClass|String|Symbol]
|
|
25
|
-
# @option attributes height [Fixnum]
|
|
26
|
-
# @option attributes width [Fixnum]
|
|
27
|
-
# @return [Vedeu::Buffers::Empty]
|
|
28
|
-
def initialize(attributes = {})
|
|
29
|
-
defaults.merge!(attributes).each do |key, value|
|
|
30
|
-
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
17
|
# @return [Array<Array<Vedeu::Models::Cell>>]
|
|
35
18
|
def buffer
|
|
36
19
|
Array.new(width) do |y|
|
|
@@ -62,7 +45,7 @@ module Vedeu
|
|
|
62
45
|
|
|
63
46
|
# Returns the default options/attributes for this class.
|
|
64
47
|
#
|
|
65
|
-
# @return [Hash<Symbol =>
|
|
48
|
+
# @return [Hash<Symbol => Fixnum|NilClass|String|Symbol>]
|
|
66
49
|
def defaults
|
|
67
50
|
{
|
|
68
51
|
height: Vedeu.height,
|
data/lib/vedeu/buffers/view.rb
CHANGED
|
@@ -8,16 +8,7 @@ module Vedeu
|
|
|
8
8
|
#
|
|
9
9
|
class View
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
# @param attributes [Hash<Symbol => NilClass|String|Symbol]
|
|
14
|
-
# @option attributes name [NilClass|String|Symbol]
|
|
15
|
-
# @return [Vedeu::Buffers::View]
|
|
16
|
-
def initialize(attributes = {})
|
|
17
|
-
defaults.merge!(attributes).each do |key, value|
|
|
18
|
-
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
19
|
-
end
|
|
20
|
-
end
|
|
11
|
+
include Vedeu::Repositories::Defaults
|
|
21
12
|
|
|
22
13
|
private
|
|
23
14
|
|
|
@@ -8,6 +8,7 @@ module Vedeu
|
|
|
8
8
|
#
|
|
9
9
|
class Document
|
|
10
10
|
|
|
11
|
+
include Vedeu::Repositories::Defaults
|
|
11
12
|
include Vedeu::Repositories::Model
|
|
12
13
|
extend Forwardable
|
|
13
14
|
|
|
@@ -18,7 +19,8 @@ module Vedeu
|
|
|
18
19
|
:y
|
|
19
20
|
|
|
20
21
|
# @!attribute [r] attributes
|
|
21
|
-
# @return [Hash
|
|
22
|
+
# @return [Hash<Symbol => String|Symbol|
|
|
23
|
+
# Vedeu::Repositories::Repository>]
|
|
22
24
|
attr_reader :attributes
|
|
23
25
|
|
|
24
26
|
# @!attribute [rw] data
|
|
@@ -37,26 +39,6 @@ module Vedeu
|
|
|
37
39
|
new(attributes).store
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
# Returns a new instance of Vedeu::Editor::Document.
|
|
41
|
-
#
|
|
42
|
-
# @note
|
|
43
|
-
# If a particular key is missing from the attributes
|
|
44
|
-
# parameter, then it is added with the respective value from
|
|
45
|
-
# #defaults.
|
|
46
|
-
#
|
|
47
|
-
# @param attributes [Hash<Symbol => String|Symbol|
|
|
48
|
-
# Vedeu::Repositories::Repository>]
|
|
49
|
-
# @option attributes data [String]
|
|
50
|
-
# @option attributes name [String|Symbol]
|
|
51
|
-
# @option attributes repository
|
|
52
|
-
# [Vedeu::Repositories::Repository]
|
|
53
|
-
# @return [Vedeu::Editor::Document]
|
|
54
|
-
def initialize(attributes = {})
|
|
55
|
-
defaults.merge!(attributes).each do |key, value|
|
|
56
|
-
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
42
|
# Returns the document as a string with line breaks if there is
|
|
61
43
|
# more than one line.
|
|
62
44
|
#
|
data/lib/vedeu/geometry/all.rb
CHANGED
data/lib/vedeu/geometry/move.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Vedeu
|
|
|
18
18
|
#
|
|
19
19
|
class Move
|
|
20
20
|
|
|
21
|
+
include Vedeu::Repositories::Defaults
|
|
21
22
|
extend Forwardable
|
|
22
23
|
|
|
23
24
|
def_delegators :geometry,
|
|
@@ -32,23 +33,6 @@ module Vedeu
|
|
|
32
33
|
new(attributes).move
|
|
33
34
|
end
|
|
34
35
|
|
|
35
|
-
# Returns a new instance of Vedeu::Geometry::Move.
|
|
36
|
-
#
|
|
37
|
-
# @param attributes [Hash<Symbol => Boolean|Fixnum|String|
|
|
38
|
-
# Symbol|Vedeu::Geometry::Repository]
|
|
39
|
-
# @option attributes name [String|Symbol] The name of the
|
|
40
|
-
# interface/view.
|
|
41
|
-
# @option attributes direction [Symbol] The direction to move;
|
|
42
|
-
# one of: :down, :left, :origin, :right, :up.
|
|
43
|
-
# @option attributes offset [Fixnum] The number of columns or
|
|
44
|
-
# rows to move by.
|
|
45
|
-
# @return [Vedeu::Geometry::Move]
|
|
46
|
-
def initialize(attributes = {})
|
|
47
|
-
defaults.merge!(attributes).each do |key, value|
|
|
48
|
-
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
36
|
# @return [FalseClass|Vedeu::Geometry::Geometry]
|
|
53
37
|
def move
|
|
54
38
|
return false unless valid?
|
|
@@ -62,15 +46,16 @@ module Vedeu
|
|
|
62
46
|
protected
|
|
63
47
|
|
|
64
48
|
# @!attribute [r] direction
|
|
65
|
-
# @return [Symbol]
|
|
49
|
+
# @return [Symbol] The direction to move; one of: :down, :left,
|
|
50
|
+
# :origin, :right, :up.
|
|
66
51
|
attr_reader :direction
|
|
67
52
|
|
|
68
53
|
# @!attribute [r] name
|
|
69
|
-
# @return [String|Symbol]
|
|
54
|
+
# @return [String|Symbol] The name of the interface/view.
|
|
70
55
|
attr_reader :name
|
|
71
56
|
|
|
72
57
|
# @!attribute [r] offset
|
|
73
|
-
# @return [Symbol]
|
|
58
|
+
# @return [Symbol] The number of columns or rows to move by.
|
|
74
59
|
attr_reader :offset
|
|
75
60
|
|
|
76
61
|
private
|
data/lib/vedeu/models/cell.rb
CHANGED
|
@@ -8,6 +8,8 @@ module Vedeu
|
|
|
8
8
|
#
|
|
9
9
|
class Cell
|
|
10
10
|
|
|
11
|
+
include Vedeu::Repositories::Defaults
|
|
12
|
+
|
|
11
13
|
# @!attribute [r] colour
|
|
12
14
|
# @return [NilClass|String]
|
|
13
15
|
attr_reader :colour
|
|
@@ -24,27 +26,6 @@ module Vedeu
|
|
|
24
26
|
# @return [NilClass|String]
|
|
25
27
|
attr_reader :value
|
|
26
28
|
|
|
27
|
-
# Returns a new instance of Vedeu::Models::Cell.
|
|
28
|
-
#
|
|
29
|
-
# @note
|
|
30
|
-
# If a particular key is missing from the attributes
|
|
31
|
-
# parameter, then it is added with the respective value from
|
|
32
|
-
# #defaults.
|
|
33
|
-
#
|
|
34
|
-
# @param attributes [Hash<Symbol => Array<Symbol|String>,
|
|
35
|
-
# Fixnum, String, Symbol]
|
|
36
|
-
# @option attributes colour [NilClass|String]
|
|
37
|
-
# @option attributes style
|
|
38
|
-
# [NilClass|Array<Symbol|String>|Symbol|String]
|
|
39
|
-
# @option attributes value [NilClass|String]
|
|
40
|
-
# @option attributes position [Vedeu::Geometry::Position]
|
|
41
|
-
# @return [Vedeu::Models::Cell]
|
|
42
|
-
def initialize(attributes = {})
|
|
43
|
-
defaults.merge!(attributes).each do |key, value|
|
|
44
|
-
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
29
|
# @return [Boolean]
|
|
49
30
|
def cell?
|
|
50
31
|
true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Vedeu
|
|
2
|
+
|
|
3
|
+
module Repositories
|
|
4
|
+
|
|
5
|
+
# Some classes expect a certain set of attributes when
|
|
6
|
+
# initialized, this module uses the #defaults method of the class
|
|
7
|
+
# to provide missing attribute keys (and values).
|
|
8
|
+
#
|
|
9
|
+
# @api private
|
|
10
|
+
#
|
|
11
|
+
module Defaults
|
|
12
|
+
|
|
13
|
+
# Returns a new instance of the class including this module.
|
|
14
|
+
#
|
|
15
|
+
# @note
|
|
16
|
+
# If a particular key is missing from the attributes
|
|
17
|
+
# parameter, then it is added with the respective value from
|
|
18
|
+
# #defaults.
|
|
19
|
+
#
|
|
20
|
+
# @param attributes [Hash]
|
|
21
|
+
# @return [void] A new instance of the class including this
|
|
22
|
+
# module.
|
|
23
|
+
def initialize(attributes = {})
|
|
24
|
+
defaults.merge!(attributes).each do |key, value|
|
|
25
|
+
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end # Defaults
|
|
30
|
+
|
|
31
|
+
end # Repositories
|
|
32
|
+
|
|
33
|
+
end # Vedeu
|
|
@@ -13,9 +13,11 @@ module Vedeu
|
|
|
13
13
|
# The null model is used when the repository cannot be found.
|
|
14
14
|
#
|
|
15
15
|
# @param klass [Class]
|
|
16
|
+
# @param attributes [Hash]
|
|
16
17
|
# @return [Symbol]
|
|
17
|
-
def null(klass)
|
|
18
|
-
define_method(:null_model)
|
|
18
|
+
def null(klass, attributes = {})
|
|
19
|
+
define_method(:null_model) { klass }
|
|
20
|
+
define_method(:null_attributes) { attributes }
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
# The real model is the usual model to use for a given
|
|
@@ -65,7 +65,17 @@ module Vedeu
|
|
|
65
65
|
def by_name(name = Vedeu.focus)
|
|
66
66
|
return find(name) if present?(name) && registered?(name)
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
attrs = if null_attributes.any?
|
|
69
|
+
null_attributes.merge!(name: name)
|
|
70
|
+
|
|
71
|
+
else
|
|
72
|
+
{
|
|
73
|
+
name: name
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
null_model.new(attrs)
|
|
69
79
|
end
|
|
70
80
|
|
|
71
81
|
# Return the model for the interface currently in focus.
|
data/lib/vedeu/version.rb
CHANGED
|
@@ -26,7 +26,9 @@ module Vedeu
|
|
|
26
26
|
it { RegisterableTestClass.must_respond_to(:null) }
|
|
27
27
|
|
|
28
28
|
it { subject.must_respond_to(:null_model) }
|
|
29
|
+
it { subject.must_respond_to(:null_attributes) }
|
|
29
30
|
it { subject.null_model.must_equal(Vedeu::Repositories::ModelTestClass) }
|
|
31
|
+
it { subject.null_attributes.must_equal({}) }
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
describe '.real' do
|
|
@@ -27,6 +27,28 @@ class VedeuMaterialColoursApp
|
|
|
27
27
|
# width 20
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# Borders can be defined as standalone declarations.
|
|
31
|
+
Vedeu.border 'no_bottom' do
|
|
32
|
+
background '#000000'
|
|
33
|
+
foreground '#ffffff'
|
|
34
|
+
show_bottom false
|
|
35
|
+
end
|
|
36
|
+
Vedeu.border 'no_left' do
|
|
37
|
+
background '#000000'
|
|
38
|
+
foreground '#ffffff'
|
|
39
|
+
show_left false
|
|
40
|
+
end
|
|
41
|
+
Vedeu.border 'no_right' do
|
|
42
|
+
background '#000000'
|
|
43
|
+
foreground '#ffffff'
|
|
44
|
+
show_right false
|
|
45
|
+
end
|
|
46
|
+
Vedeu.border 'no_top' do
|
|
47
|
+
background '#000000'
|
|
48
|
+
foreground '#ffffff'
|
|
49
|
+
show_top false
|
|
50
|
+
end
|
|
51
|
+
|
|
30
52
|
Vedeu.interface 'main_interface' do
|
|
31
53
|
border 'main_interface' do
|
|
32
54
|
colour foreground: '#ffffff', background: :default
|
|
@@ -98,7 +120,7 @@ class VedeuMaterialColoursApp
|
|
|
98
120
|
height 4
|
|
99
121
|
width 10
|
|
100
122
|
end
|
|
101
|
-
colour foreground: '#
|
|
123
|
+
colour foreground: '#ffffff', background: '#9c27b0'
|
|
102
124
|
end
|
|
103
125
|
|
|
104
126
|
Vedeu.interface 'no_bottom' do
|
|
@@ -108,7 +130,7 @@ class VedeuMaterialColoursApp
|
|
|
108
130
|
height 4
|
|
109
131
|
width 10
|
|
110
132
|
end
|
|
111
|
-
colour foreground: '#
|
|
133
|
+
colour foreground: '#ffffff', background: '#673ab7'
|
|
112
134
|
end
|
|
113
135
|
|
|
114
136
|
Vedeu.interface 'no_left' do
|
|
@@ -118,7 +140,7 @@ class VedeuMaterialColoursApp
|
|
|
118
140
|
height 4
|
|
119
141
|
width 10
|
|
120
142
|
end
|
|
121
|
-
colour foreground: '#
|
|
143
|
+
colour foreground: '#ffffff', background: '#3f51b5'
|
|
122
144
|
end
|
|
123
145
|
|
|
124
146
|
Vedeu.interface 'no_right' do
|
|
@@ -128,7 +150,7 @@ class VedeuMaterialColoursApp
|
|
|
128
150
|
height 4
|
|
129
151
|
width 10
|
|
130
152
|
end
|
|
131
|
-
colour foreground: '#
|
|
153
|
+
colour foreground: '#ffffff', background: '#2196f3'
|
|
132
154
|
end
|
|
133
155
|
|
|
134
156
|
Vedeu.interface 'custom_corners' do
|
|
@@ -138,7 +160,7 @@ class VedeuMaterialColoursApp
|
|
|
138
160
|
height 4
|
|
139
161
|
width 10
|
|
140
162
|
end
|
|
141
|
-
colour foreground: '#
|
|
163
|
+
colour foreground: '#ffffff', background: '#03a9f4'
|
|
142
164
|
end
|
|
143
165
|
|
|
144
166
|
Vedeu.interface 'custom_sides' do
|
|
@@ -153,6 +175,7 @@ class VedeuMaterialColoursApp
|
|
|
153
175
|
|
|
154
176
|
# Borders can be defined as part of the interface definition.
|
|
155
177
|
Vedeu.interface 'only_top' do
|
|
178
|
+
colour foreground: '#ffffff', background: '#009688'
|
|
156
179
|
border do
|
|
157
180
|
foreground '#ffffff'
|
|
158
181
|
show_right false
|
|
@@ -165,10 +188,10 @@ class VedeuMaterialColoursApp
|
|
|
165
188
|
height 4
|
|
166
189
|
width 10
|
|
167
190
|
end
|
|
168
|
-
colour foreground: '#ffffff', background: '#009688'
|
|
169
191
|
end
|
|
170
192
|
|
|
171
193
|
Vedeu.interface 'only_bottom' do
|
|
194
|
+
colour foreground: '#000000', background: '#8bc34a'
|
|
172
195
|
border do
|
|
173
196
|
foreground '#000000'
|
|
174
197
|
show_top false
|
|
@@ -181,10 +204,10 @@ class VedeuMaterialColoursApp
|
|
|
181
204
|
height 4
|
|
182
205
|
width 10
|
|
183
206
|
end
|
|
184
|
-
colour foreground: '#000000', background: '#8bc34a'
|
|
185
207
|
end
|
|
186
208
|
|
|
187
209
|
Vedeu.interface 'only_left' do
|
|
210
|
+
colour foreground: '#000000', background: '#cddc39'
|
|
188
211
|
border do
|
|
189
212
|
foreground '#000000'
|
|
190
213
|
show_top false
|
|
@@ -197,10 +220,10 @@ class VedeuMaterialColoursApp
|
|
|
197
220
|
height 4
|
|
198
221
|
width 10
|
|
199
222
|
end
|
|
200
|
-
colour foreground: '#000000', background: '#cddc39'
|
|
201
223
|
end
|
|
202
224
|
|
|
203
225
|
Vedeu.interface 'only_right' do
|
|
226
|
+
colour foreground: '#000000', background: '#ffeb3b'
|
|
204
227
|
border do
|
|
205
228
|
foreground '#000000'
|
|
206
229
|
show_top false
|
|
@@ -213,7 +236,6 @@ class VedeuMaterialColoursApp
|
|
|
213
236
|
height 4
|
|
214
237
|
width 10
|
|
215
238
|
end
|
|
216
|
-
colour foreground: '#000000', background: '#ffeb3b'
|
|
217
239
|
end
|
|
218
240
|
|
|
219
241
|
Vedeu.interface 'custom_colour' do
|
|
@@ -248,23 +270,7 @@ class VedeuMaterialColoursApp
|
|
|
248
270
|
zindex(0)
|
|
249
271
|
end
|
|
250
272
|
|
|
251
|
-
|
|
252
|
-
Vedeu.border 'no_bottom' do
|
|
253
|
-
foreground '#ffffff'
|
|
254
|
-
show_bottom false
|
|
255
|
-
end
|
|
256
|
-
Vedeu.border 'no_left' do
|
|
257
|
-
foreground '#ffffff'
|
|
258
|
-
show_left false
|
|
259
|
-
end
|
|
260
|
-
Vedeu.border 'no_right' do
|
|
261
|
-
foreground '#ffffff'
|
|
262
|
-
show_right false
|
|
263
|
-
end
|
|
264
|
-
Vedeu.border 'no_top' do
|
|
265
|
-
foreground '#ffffff'
|
|
266
|
-
show_top false
|
|
267
|
-
end
|
|
273
|
+
|
|
268
274
|
|
|
269
275
|
Vedeu.keymap('_global_') do
|
|
270
276
|
key(:up) { Vedeu.trigger(:_cursor_up_) }
|
|
@@ -509,7 +515,7 @@ class VedeuMaterialColoursApp
|
|
|
509
515
|
end
|
|
510
516
|
view('custom_corners') do
|
|
511
517
|
border do
|
|
512
|
-
foreground '#
|
|
518
|
+
foreground '#000000'
|
|
513
519
|
top_right 'B'
|
|
514
520
|
top_left 'A'
|
|
515
521
|
bottom_right 'D'
|
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.6.
|
|
4
|
+
version: 0.6.59
|
|
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-11-
|
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: guard
|
|
@@ -421,7 +421,6 @@ files:
|
|
|
421
421
|
- lib/vedeu/geometry/grid.rb
|
|
422
422
|
- lib/vedeu/geometry/horizontal_alignment.rb
|
|
423
423
|
- lib/vedeu/geometry/move.rb
|
|
424
|
-
- lib/vedeu/geometry/null.rb
|
|
425
424
|
- lib/vedeu/geometry/position.rb
|
|
426
425
|
- lib/vedeu/geometry/repository.rb
|
|
427
426
|
- lib/vedeu/geometry/validator.rb
|
|
@@ -504,6 +503,7 @@ files:
|
|
|
504
503
|
- lib/vedeu/plugins/plugins.rb
|
|
505
504
|
- lib/vedeu/repositories/all.rb
|
|
506
505
|
- lib/vedeu/repositories/collection.rb
|
|
506
|
+
- lib/vedeu/repositories/defaults.rb
|
|
507
507
|
- lib/vedeu/repositories/model.rb
|
|
508
508
|
- lib/vedeu/repositories/registerable.rb
|
|
509
509
|
- lib/vedeu/repositories/repositories.rb
|
|
@@ -607,7 +607,6 @@ files:
|
|
|
607
607
|
- test/lib/vedeu/geometry/grid_test.rb
|
|
608
608
|
- test/lib/vedeu/geometry/horizontal_alignment_test.rb
|
|
609
609
|
- test/lib/vedeu/geometry/move_test.rb
|
|
610
|
-
- test/lib/vedeu/geometry/null_test.rb
|
|
611
610
|
- test/lib/vedeu/geometry/position_test.rb
|
|
612
611
|
- test/lib/vedeu/geometry/repository_test.rb
|
|
613
612
|
- test/lib/vedeu/geometry/validator_test.rb
|
|
@@ -677,6 +676,7 @@ files:
|
|
|
677
676
|
- test/lib/vedeu/plugins/plugin_test.rb
|
|
678
677
|
- test/lib/vedeu/plugins/plugins_test.rb
|
|
679
678
|
- test/lib/vedeu/repositories/collection_test.rb
|
|
679
|
+
- test/lib/vedeu/repositories/defaults_test.rb
|
|
680
680
|
- test/lib/vedeu/repositories/model_test.rb
|
|
681
681
|
- test/lib/vedeu/repositories/registerable_test.rb
|
|
682
682
|
- test/lib/vedeu/repositories/repositories_test.rb
|
|
@@ -820,7 +820,6 @@ test_files:
|
|
|
820
820
|
- test/lib/vedeu/geometry/grid_test.rb
|
|
821
821
|
- test/lib/vedeu/geometry/horizontal_alignment_test.rb
|
|
822
822
|
- test/lib/vedeu/geometry/move_test.rb
|
|
823
|
-
- test/lib/vedeu/geometry/null_test.rb
|
|
824
823
|
- test/lib/vedeu/geometry/position_test.rb
|
|
825
824
|
- test/lib/vedeu/geometry/repository_test.rb
|
|
826
825
|
- test/lib/vedeu/geometry/validator_test.rb
|
|
@@ -890,6 +889,7 @@ test_files:
|
|
|
890
889
|
- test/lib/vedeu/plugins/plugin_test.rb
|
|
891
890
|
- test/lib/vedeu/plugins/plugins_test.rb
|
|
892
891
|
- test/lib/vedeu/repositories/collection_test.rb
|
|
892
|
+
- test/lib/vedeu/repositories/defaults_test.rb
|
|
893
893
|
- test/lib/vedeu/repositories/model_test.rb
|
|
894
894
|
- test/lib/vedeu/repositories/registerable_test.rb
|
|
895
895
|
- test/lib/vedeu/repositories/repositories_test.rb
|
data/lib/vedeu/geometry/null.rb
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
module Vedeu
|
|
2
|
-
|
|
3
|
-
module Geometry
|
|
4
|
-
|
|
5
|
-
# Provides a non-existent model to swallow messages.
|
|
6
|
-
#
|
|
7
|
-
# @api private
|
|
8
|
-
#
|
|
9
|
-
class Null < Vedeu::Null::Generic
|
|
10
|
-
|
|
11
|
-
extend Forwardable
|
|
12
|
-
|
|
13
|
-
def_delegators :area,
|
|
14
|
-
:bordered_height,
|
|
15
|
-
:bordered_width,
|
|
16
|
-
:bottom,
|
|
17
|
-
:bx,
|
|
18
|
-
:bxn,
|
|
19
|
-
:by,
|
|
20
|
-
:byn,
|
|
21
|
-
:east,
|
|
22
|
-
:height,
|
|
23
|
-
:left,
|
|
24
|
-
:north,
|
|
25
|
-
:right,
|
|
26
|
-
:south,
|
|
27
|
-
:top,
|
|
28
|
-
:west,
|
|
29
|
-
:width,
|
|
30
|
-
:x,
|
|
31
|
-
:xn,
|
|
32
|
-
:y,
|
|
33
|
-
:yn
|
|
34
|
-
|
|
35
|
-
# @!attribute [rw] maximised
|
|
36
|
-
# @return [Boolean]
|
|
37
|
-
attr_accessor :maximised
|
|
38
|
-
|
|
39
|
-
# @!attribute [r] name
|
|
40
|
-
# @return [NilClass|String|Symbol]
|
|
41
|
-
attr_reader :name
|
|
42
|
-
|
|
43
|
-
# Returns a new instance of Vedeu::Geometry::Null.
|
|
44
|
-
#
|
|
45
|
-
# @param attributes [Hash<Symbol => void>]
|
|
46
|
-
# @option attributes name [String|Symbol|NilClass]
|
|
47
|
-
# @return [Vedeu::Geometry::Null]
|
|
48
|
-
def initialize(attributes = {})
|
|
49
|
-
@attributes = attributes
|
|
50
|
-
@name = @attributes[:name]
|
|
51
|
-
@maximised = @attributes.fetch(:maximised, false)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
# @return [Vedeu::Geometry::Area]
|
|
57
|
-
def area
|
|
58
|
-
@area ||= Vedeu::Geometry::Area.from_attributes(y_default: Vedeu.height,
|
|
59
|
-
x_default: Vedeu.width)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end # Null
|
|
63
|
-
|
|
64
|
-
end # Geometry
|
|
65
|
-
|
|
66
|
-
end # Vedeu
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
module Vedeu
|
|
4
|
-
|
|
5
|
-
module Geometry
|
|
6
|
-
|
|
7
|
-
describe Null do
|
|
8
|
-
|
|
9
|
-
let(:described) { Vedeu::Geometry::Null }
|
|
10
|
-
let(:instance) { described.new(attributes) }
|
|
11
|
-
let(:attributes){
|
|
12
|
-
{
|
|
13
|
-
name: _name
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
let(:_name) { 'null_geometry' }
|
|
17
|
-
|
|
18
|
-
describe '#initialize' do
|
|
19
|
-
it { instance.must_be_instance_of(described) }
|
|
20
|
-
it {
|
|
21
|
-
instance.instance_variable_get('@attributes').must_equal(attributes)
|
|
22
|
-
}
|
|
23
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe 'accessors' do
|
|
27
|
-
it { instance.must_respond_to(:maximised) }
|
|
28
|
-
it { instance.must_respond_to(:maximised=) }
|
|
29
|
-
it { instance.must_respond_to(:name) }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe '#height' do
|
|
33
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
34
|
-
|
|
35
|
-
it { instance.height.must_equal(25) }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe '#width' do
|
|
39
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
40
|
-
|
|
41
|
-
it { instance.width.must_equal(40) }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe '#x' do
|
|
45
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
46
|
-
|
|
47
|
-
it { instance.x.must_equal(1) }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe '#xn' do
|
|
51
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
52
|
-
|
|
53
|
-
it { instance.xn.must_equal(40) }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe '#y' do
|
|
57
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
58
|
-
|
|
59
|
-
it { instance.y.must_equal(1) }
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe '#yn' do
|
|
63
|
-
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
|
64
|
-
|
|
65
|
-
it { instance.yn.must_equal(25) }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end # Null
|
|
69
|
-
|
|
70
|
-
end # Geometry
|
|
71
|
-
|
|
72
|
-
end # Vedeu
|