vedeu 0.8.12 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/vedeu +1 -1
- data/docs/dsl/by_method/profile.md +1 -1
- data/docs/dsl/by_method/view/repositories.md +4 -0
- data/integrations/342_streams.rb +1 -1
- data/integrations/dsl_app_001.rb +1 -0
- data/integrations/dsl_app_002.rb +1 -0
- data/integrations/dsl_app_003.rb +1 -0
- data/integrations/dsl_app_004.rb +1 -0
- data/integrations/dsl_app_005.rb +1 -0
- data/integrations/dsl_app_006.rb +1 -0
- data/integrations/dsl_app_007.rb +1 -0
- data/integrations/dsl_app_008.rb +1 -0
- data/integrations/dsl_app_009.rb +1 -0
- data/integrations/dsl_app_010.rb +1 -0
- data/integrations/dsl_app_011.rb +1 -0
- data/integrations/dsl_app_012.rb +1 -0
- data/integrations/dsl_app_013.rb +1 -0
- data/integrations/dsl_app_014.rb +1 -0
- data/integrations/dsl_app_015.rb +1 -0
- data/integrations/dsl_app_016.rb +1 -0
- data/integrations/dsl_app_017.rb +1 -0
- data/integrations/dsl_app_018.rb +1 -0
- data/integrations/dsl_app_019.rb +1 -0
- data/integrations/dsl_app_020.rb +1 -0
- data/integrations/dsl_app_021.rb +1 -0
- data/integrations/dsl_app_022.rb +1 -0
- data/integrations/dsl_app_border_001.rb +1 -0
- data/integrations/dsl_app_border_002.rb +1 -0
- data/integrations/dsl_app_border_003.rb +1 -0
- data/integrations/dsl_app_border_004.rb +1 -0
- data/integrations/dsl_app_border_005.rb +1 -0
- data/lib/vedeu/application/application_view.rb +3 -3
- data/lib/vedeu/borders/dsl.rb +2 -2
- data/lib/vedeu/borders/title.rb +1 -1
- data/lib/vedeu/buffers/view.rb +1 -11
- data/lib/vedeu/cells/empty.rb +2 -2
- data/lib/vedeu/coercers/alignment.rb +5 -5
- data/lib/vedeu/coercers/coercer.rb +4 -5
- data/lib/vedeu/coercers/colour_attributes.rb +1 -1
- data/lib/vedeu/coercers/horizontal_alignment.rb +3 -3
- data/lib/vedeu/coercers/position.rb +4 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +3 -3
- data/lib/vedeu/colours/colour.rb +2 -1
- data/lib/vedeu/colours/translator.rb +2 -2
- data/lib/vedeu/common.rb +20 -1
- data/lib/vedeu/configuration/api.rb +8 -6
- data/lib/vedeu/configuration/configuration.rb +2 -2
- data/lib/vedeu/cursors/coordinate.rb +2 -2
- data/lib/vedeu/cursors/cursor.rb +3 -2
- data/lib/vedeu/dsl/border.rb +1 -1
- data/lib/vedeu/dsl/elements.rb +9 -9
- data/lib/vedeu/dsl/geometry.rb +3 -3
- data/lib/vedeu/dsl/helpers/wordwrap.rb +4 -4
- data/lib/vedeu/dsl/view.rb +9 -9
- data/lib/vedeu/dsl/views.rb +2 -2
- data/lib/vedeu/editor/document.rb +1 -1
- data/lib/vedeu/editor/item.rb +17 -15
- data/lib/vedeu/esc/colours.rb +21 -20
- data/lib/vedeu/geometries/area/area.rb +6 -2
- data/lib/vedeu/geometries/dsl/grid.rb +2 -2
- data/lib/vedeu/geometries/geometry.rb +34 -46
- data/lib/vedeu/geometries/move.rb +5 -4
- data/lib/vedeu/geometries/position.rb +1 -1
- data/lib/vedeu/groups/dsl.rb +2 -2
- data/lib/vedeu/groups/group.rb +1 -1
- data/lib/vedeu/groups/refresh.rb +2 -2
- data/lib/vedeu/input/capture.rb +2 -1
- data/lib/vedeu/input/dsl.rb +22 -16
- data/lib/vedeu/input/key.rb +1 -1
- data/lib/vedeu/input/mapper.rb +6 -6
- data/lib/vedeu/input/read.rb +2 -2
- data/lib/vedeu/interfaces/dsl.rb +2 -2
- data/lib/vedeu/logging/debug.rb +10 -10
- data/lib/vedeu/logging/timer.rb +7 -11
- data/lib/vedeu/menus/dsl.rb +2 -2
- data/lib/vedeu/models/focus.rb +3 -3
- data/lib/vedeu/models/page.rb +1 -1
- data/lib/vedeu/models/row.rb +1 -1
- data/lib/vedeu/presentation/style.rb +1 -1
- data/lib/vedeu/renderers/escape.rb +0 -6
- data/lib/vedeu/renderers/options.rb +3 -3
- data/lib/vedeu/renderers/text.rb +0 -6
- data/lib/vedeu/repositories/assemblage.rb +1 -1
- data/lib/vedeu/repositories/defaults.rb +2 -2
- data/lib/vedeu/repositories/repositories.rb +17 -1
- data/lib/vedeu/repositories/repository.rb +5 -5
- data/lib/vedeu/runtime/application.rb +3 -3
- data/lib/vedeu/runtime/main_loop.rb +2 -2
- data/lib/vedeu/runtime/router.rb +11 -11
- data/lib/vedeu/support/point.rb +18 -15
- data/lib/vedeu/templating/helpers.rb +1 -1
- data/lib/vedeu/templating/template.rb +4 -4
- data/lib/vedeu/terminal/terminal.rb +1 -1
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/chars.rb +3 -3
- data/lib/vedeu/views/line.rb +1 -1
- data/lib/vedeu/views/lines.rb +3 -3
- data/lib/vedeu/views/stream.rb +1 -1
- data/lib/vedeu/views/streams.rb +3 -3
- data/lib/vedeu/views/view.rb +2 -2
- data/test/lib/vedeu/common_test.rb +43 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/esc/colours_test.rb +42 -0
- data/test/lib/vedeu/input/dsl_test.rb +8 -8
- data/test/lib/vedeu/logging/debug_test.rb +2 -2
- data/test/lib/vedeu/logging/timer_test.rb +4 -13
- data/test/lib/vedeu/renderers/escape_test.rb +24 -0
- data/test/lib/vedeu/repositories/repositories_test.rb +6 -0
- data/test/support/examples/material_colours_app.rb +30 -51
- data/vedeu.gemspec +2 -2
- metadata +9 -6
data/lib/vedeu/input/mapper.rb
CHANGED
@@ -32,12 +32,12 @@ module Vedeu
|
|
32
32
|
# @macro raise_missing_required
|
33
33
|
# @return [Boolean]
|
34
34
|
def registered?(key = nil, name = nil)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
raise Vedeu::Error::MissingRequired,
|
36
|
+
'Cannot check whether a key is registered to a keymap ' \
|
37
|
+
'without the key.' if absent?(key)
|
38
|
+
raise Vedeu::Error::MissingRequired,
|
39
|
+
'Cannot check whether a key is registered to a keymap ' \
|
40
|
+
'without the keymap name.' if absent?(name)
|
41
41
|
|
42
42
|
new(key, name).registered?
|
43
43
|
end
|
data/lib/vedeu/input/read.rb
CHANGED
@@ -102,8 +102,8 @@ module Vedeu
|
|
102
102
|
# @return [Symbol]
|
103
103
|
def mode
|
104
104
|
unless valid_mode?
|
105
|
-
|
106
|
-
|
105
|
+
raise Vedeu::Error::InvalidSyntax,
|
106
|
+
':mode must be `:raw`, `:fake` or `:cooked`.'
|
107
107
|
end
|
108
108
|
|
109
109
|
options[:mode]
|
data/lib/vedeu/interfaces/dsl.rb
CHANGED
@@ -39,8 +39,8 @@ module Vedeu
|
|
39
39
|
# @return [Vedeu::Interfaces::Interface]
|
40
40
|
# @todo More documentation required.
|
41
41
|
def interface(name, &block)
|
42
|
-
|
43
|
-
|
42
|
+
raise Vedeu::Error::MissingRequired unless name
|
43
|
+
raise Vedeu::Error::RequiresBlock unless block_given?
|
44
44
|
|
45
45
|
attributes = { client: client(&block), name: name }
|
46
46
|
|
data/lib/vedeu/logging/debug.rb
CHANGED
@@ -41,11 +41,11 @@ module Vedeu
|
|
41
41
|
# @macro raise_requires_block
|
42
42
|
# @return [void]
|
43
43
|
# @yieldreturn [void] The section of the application to profile.
|
44
|
-
def profile(filename = '/tmp/
|
45
|
-
fail Vedeu::Error::RequiresBlock unless block_given?
|
46
|
-
|
44
|
+
def profile(filename = '/tmp/vedeu_profile', &block)
|
47
45
|
Vedeu.requires_gem!('ruby-prof')
|
48
46
|
|
47
|
+
raise Vedeu::Error::RequiresBlock unless block_given?
|
48
|
+
|
49
49
|
# ::RubyProf.measure_mode = ::RubyProf::WALL_TIME
|
50
50
|
# ::RubyProf.measure_mode = ::RubyProf::PROCESS_TIME
|
51
51
|
::RubyProf.measure_mode = ::RubyProf::CPU_TIME
|
@@ -69,28 +69,28 @@ module Vedeu
|
|
69
69
|
# ::RubyProf::CallTreePrinter.new(result).print(file)
|
70
70
|
|
71
71
|
# Creates a flat report in text format
|
72
|
-
# ::RubyProf::FlatPrinter
|
72
|
+
# ::RubyProf::FlatPrinter.new(result).print(file)
|
73
73
|
|
74
74
|
# - same as above but more verbose
|
75
|
-
# ::RubyProf::FlatPrinterWithLineNumbers
|
75
|
+
# ::RubyProf::FlatPrinterWithLineNumbers.new(result).print(file)
|
76
76
|
|
77
77
|
# - Creates a call graph report in text format
|
78
|
-
# ::RubyProf::GraphPrinter
|
78
|
+
# ::RubyProf::GraphPrinter.new(result).print(file)
|
79
79
|
|
80
80
|
# - Creates a call graph report in HTML (separate files per
|
81
81
|
# thread)
|
82
|
-
# ::RubyProf::GraphHtmlPrinter
|
82
|
+
# ::RubyProf::GraphHtmlPrinter.new(result).print(file)
|
83
83
|
|
84
84
|
# - Creates a call graph report in GraphViz's DOT format
|
85
85
|
# which can be converted to an image
|
86
|
-
# ::RubyProf::DotPrinter
|
86
|
+
# ::RubyProf::DotPrinter.new(result).print(file)
|
87
87
|
|
88
88
|
# - Creates a call tree report compatible with KCachegrind.
|
89
|
-
# ::RubyProf::CallTreePrinter
|
89
|
+
# ::RubyProf::CallTreePrinter.new(result).print(file)
|
90
90
|
|
91
91
|
# - Uses the other printers to create several reports in one
|
92
92
|
# profiling run
|
93
|
-
# ::RubyProf::MultiPrinter
|
93
|
+
# ::RubyProf::MultiPrinter.new(result).print(file)
|
94
94
|
end
|
95
95
|
|
96
96
|
work
|
data/lib/vedeu/logging/timer.rb
CHANGED
@@ -41,22 +41,18 @@ module Vedeu
|
|
41
41
|
# @return [void|NilClass] The return value of the executed
|
42
42
|
# block if given, or nil if debugging is disabled.
|
43
43
|
def measure(&block)
|
44
|
-
|
45
|
-
if Vedeu.config.debug?
|
46
|
-
work = yield
|
44
|
+
raise Vedeu::Error::RequiresBlock unless block_given?
|
47
45
|
|
48
|
-
|
49
|
-
|
46
|
+
if Vedeu.config.debug?
|
47
|
+
work = yield
|
50
48
|
|
51
|
-
|
49
|
+
Vedeu.log(type: :timer,
|
50
|
+
message: "#{message} took #{elapsed}ms.")
|
52
51
|
|
53
|
-
|
54
|
-
yield
|
55
|
-
|
56
|
-
end
|
52
|
+
work
|
57
53
|
|
58
54
|
else
|
59
|
-
|
55
|
+
yield
|
60
56
|
|
61
57
|
end
|
62
58
|
end
|
data/lib/vedeu/menus/dsl.rb
CHANGED
@@ -38,8 +38,8 @@ module Vedeu
|
|
38
38
|
# @macro raise_missing_required
|
39
39
|
# @return [API::Menu]
|
40
40
|
def menu(name, &block)
|
41
|
-
|
42
|
-
|
41
|
+
raise Vedeu::Error::MissingRequired unless name
|
42
|
+
raise Vedeu::Error::RequiresBlock unless block_given?
|
43
43
|
|
44
44
|
attributes = { client: client(&block), name: name }
|
45
45
|
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -209,9 +209,9 @@ module Vedeu
|
|
209
209
|
|
210
210
|
# @raise [Vedeu::Error::ModelNotFound]
|
211
211
|
def not_registered!(name)
|
212
|
-
|
213
|
-
|
214
|
-
|
212
|
+
raise Vedeu::Error::ModelNotFound,
|
213
|
+
"Cannot focus '#{name}' as this interface has not been " \
|
214
|
+
'registered.'
|
215
215
|
end
|
216
216
|
|
217
217
|
# Return the name of the interface in focus after triggering the
|
data/lib/vedeu/models/page.rb
CHANGED
data/lib/vedeu/models/row.rb
CHANGED
@@ -53,7 +53,7 @@ module Vedeu
|
|
53
53
|
|
54
54
|
# @macro raise_not_implemented
|
55
55
|
def write
|
56
|
-
|
56
|
+
raise Vedeu::Error::NotImplemented, 'Including classes implement this.'
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
@@ -81,7 +81,7 @@ module Vedeu
|
|
81
81
|
|
82
82
|
# @macro raise_not_implemented
|
83
83
|
def content
|
84
|
-
|
84
|
+
raise Vedeu::Error::NotImplemented, 'Including classes implement this.'
|
85
85
|
end
|
86
86
|
|
87
87
|
# @macro defaults_method
|
@@ -90,7 +90,7 @@ module Vedeu
|
|
90
90
|
compression: Vedeu.config.compression?,
|
91
91
|
end_tag: '</td>',
|
92
92
|
end_row_tag: '</tr>',
|
93
|
-
filename: '
|
93
|
+
filename: '/tmp/vedeu_out',
|
94
94
|
output: '',
|
95
95
|
start_tag: '<td',
|
96
96
|
start_row_tag: '<tr>',
|
data/lib/vedeu/renderers/text.rb
CHANGED
@@ -41,8 +41,8 @@ module Vedeu
|
|
41
41
|
# @macro raise_invalid_syntax
|
42
42
|
# @return [Hash]
|
43
43
|
def validate(attributes)
|
44
|
-
|
45
|
-
|
44
|
+
raise Vedeu::Error::InvalidSyntax,
|
45
|
+
'Argument :attributes is not a Hash.' unless hash?(attributes)
|
46
46
|
|
47
47
|
attributes.keep_if { |key, _| defaults.key?(key) }
|
48
48
|
end
|
@@ -38,11 +38,22 @@ module Vedeu
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
# Access all the repositories stored.
|
42
|
+
#
|
43
|
+
# @return [Array]
|
44
|
+
def repositories
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
41
48
|
# Remove all stored models from the repository.
|
42
49
|
#
|
43
50
|
# @return [Boolean]
|
44
51
|
def reset!
|
45
|
-
|
52
|
+
storage.map do |repository|
|
53
|
+
Vedeu.log(type: :red,
|
54
|
+
message: "Resetting: #{repository.name}")
|
55
|
+
repository.reset!
|
56
|
+
end
|
46
57
|
|
47
58
|
true
|
48
59
|
end
|
@@ -59,4 +70,9 @@ module Vedeu
|
|
59
70
|
|
60
71
|
end # Repositories
|
61
72
|
|
73
|
+
# @!method repositories
|
74
|
+
# @see Vedeu::Repositories
|
75
|
+
def_delegators Vedeu::Repositories,
|
76
|
+
:repositories
|
77
|
+
|
62
78
|
end # Vedeu
|
@@ -95,8 +95,8 @@ module Vedeu
|
|
95
95
|
# found with this name.
|
96
96
|
# @return [Hash<String => Object>]
|
97
97
|
def find!(name)
|
98
|
-
find(name) ||
|
99
|
-
|
98
|
+
find(name) || raise(Vedeu::Error::ModelNotFound,
|
99
|
+
"Cannot find model by name: '#{name}'")
|
100
100
|
end
|
101
101
|
|
102
102
|
# Find a model by name, registers the model by name when not
|
@@ -182,9 +182,9 @@ module Vedeu
|
|
182
182
|
# @macro raise_missing_required
|
183
183
|
# @return [Boolean]
|
184
184
|
def valid_model?(model)
|
185
|
-
|
186
|
-
|
187
|
-
|
185
|
+
raise Vedeu::Error::MissingRequired,
|
186
|
+
"Cannot store model '#{model.class}' without a name " \
|
187
|
+
'attribute.' unless present?(model.name)
|
188
188
|
end
|
189
189
|
|
190
190
|
end # Repository
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
25
25
|
|
26
26
|
Vedeu.trigger(:_drb_restart_)
|
27
27
|
|
28
|
-
|
28
|
+
raise Vedeu::Error::ModeSwitch
|
29
29
|
end
|
30
30
|
|
31
31
|
# Start the main loop.
|
@@ -64,7 +64,7 @@ module Vedeu
|
|
64
64
|
# the running application.
|
65
65
|
# @return [void]
|
66
66
|
def safe_exit_point!
|
67
|
-
|
67
|
+
raise Vedeu::Error::Interrupt if @started && !@loop
|
68
68
|
end
|
69
69
|
|
70
70
|
# :nocov:
|
data/lib/vedeu/runtime/router.rb
CHANGED
@@ -25,8 +25,8 @@ module Vedeu
|
|
25
25
|
# @return [void]
|
26
26
|
def add_controller(controller, klass)
|
27
27
|
unless present?(controller)
|
28
|
-
|
29
|
-
|
28
|
+
raise Vedeu::Error::MissingRequired,
|
29
|
+
'Cannot store controller without a name attribute.'
|
30
30
|
end
|
31
31
|
|
32
32
|
Vedeu.log(type: :create,
|
@@ -68,9 +68,9 @@ module Vedeu
|
|
68
68
|
storage
|
69
69
|
|
70
70
|
else
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
raise Vedeu::Error::MissingRequired,
|
72
|
+
'Cannot store action without a controller or name ' \
|
73
|
+
'attribute.'
|
74
74
|
|
75
75
|
end
|
76
76
|
end
|
@@ -111,12 +111,12 @@ module Vedeu
|
|
111
111
|
if registered?(controller)
|
112
112
|
return true if storage[controller][:actions].include?(action)
|
113
113
|
|
114
|
-
|
115
|
-
|
114
|
+
raise Vedeu::Error::ActionNotFound,
|
115
|
+
"#{action} is not registered for #{controller}."
|
116
116
|
|
117
117
|
else
|
118
|
-
|
119
|
-
|
118
|
+
raise Vedeu::Error::ControllerNotFound,
|
119
|
+
"#{controller} is not registered."
|
120
120
|
|
121
121
|
end
|
122
122
|
end
|
@@ -143,8 +143,8 @@ module Vedeu
|
|
143
143
|
storage[controller][:klass]
|
144
144
|
|
145
145
|
else
|
146
|
-
|
147
|
-
|
146
|
+
raise Vedeu::Error::MissingRequired,
|
147
|
+
"Cannot route to #{controller} as no class defined."
|
148
148
|
|
149
149
|
end
|
150
150
|
end
|
data/lib/vedeu/support/point.rb
CHANGED
@@ -11,6 +11,12 @@ module Vedeu
|
|
11
11
|
#
|
12
12
|
class Point
|
13
13
|
|
14
|
+
include Vedeu::Common
|
15
|
+
|
16
|
+
# @!attribute [r] value
|
17
|
+
# @return [Fixnum]
|
18
|
+
attr_reader :value
|
19
|
+
|
14
20
|
# @param (see #initialize)
|
15
21
|
# @macro raise_invalid_syntax
|
16
22
|
# @return (see #initialize)
|
@@ -31,14 +37,16 @@ module Vedeu
|
|
31
37
|
def initialize(value: nil, min: 1, max: Float::INFINITY)
|
32
38
|
@min = min
|
33
39
|
@max = max
|
34
|
-
@value = value
|
40
|
+
@value = value || @min
|
41
|
+
|
42
|
+
freeze
|
35
43
|
end
|
36
44
|
|
37
45
|
# @macro raise_invalid_syntax
|
38
46
|
# @return [Vedeu::Point]
|
39
47
|
def coerce
|
40
|
-
|
41
|
-
|
48
|
+
raise Vedeu::Error::InvalidSyntax,
|
49
|
+
"Expecting 'min' to be less than 'max'." if min > max
|
42
50
|
|
43
51
|
if value < min
|
44
52
|
Vedeu::Point.coerce(value: min, min: min, max: max)
|
@@ -54,12 +62,7 @@ module Vedeu
|
|
54
62
|
|
55
63
|
# @return [Boolean]
|
56
64
|
def valid?
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
# @return [Fixnum]
|
61
|
-
def value
|
62
|
-
@value ||= min
|
65
|
+
numeric?(value) && value >= min && value <= max
|
63
66
|
end
|
64
67
|
|
65
68
|
private
|
@@ -67,19 +70,19 @@ module Vedeu
|
|
67
70
|
# @macro raise_invalid_syntax
|
68
71
|
# @return [Fixnum]
|
69
72
|
def min
|
70
|
-
return @min if @min
|
73
|
+
return @min if numeric?(@min)
|
71
74
|
|
72
|
-
|
73
|
-
|
75
|
+
raise Vedeu::Error::InvalidSyntax,
|
76
|
+
"Expecting 'min' to be a Fixnum."
|
74
77
|
end
|
75
78
|
|
76
79
|
# @macro raise_invalid_syntax
|
77
80
|
# @return [Fixnum]
|
78
81
|
def max
|
79
|
-
return @max if @max
|
82
|
+
return @max if numeric?(@max) || @max == Float::INFINITY
|
80
83
|
|
81
|
-
|
82
|
-
|
84
|
+
raise Vedeu::Error::InvalidSyntax,
|
85
|
+
"Expecting 'max' to be a Fixnum or Float::INFINITY."
|
83
86
|
end
|
84
87
|
|
85
88
|
end # Point
|
@@ -52,12 +52,12 @@ module Vedeu
|
|
52
52
|
# @macro raise_missing_required
|
53
53
|
# @return [String]
|
54
54
|
def path
|
55
|
-
|
56
|
-
|
55
|
+
raise Vedeu::Error::MissingRequired,
|
56
|
+
'No path to template specified.' if @path.empty?
|
57
57
|
|
58
58
|
unless File.exist?(@path)
|
59
|
-
|
60
|
-
|
59
|
+
raise Vedeu::Error::MissingRequired,
|
60
|
+
"Template file cannot be found. (#{@path})"
|
61
61
|
end
|
62
62
|
|
63
63
|
@path
|
@@ -28,7 +28,7 @@ module Vedeu
|
|
28
28
|
# @macro raise_requires_block
|
29
29
|
# @return [Array]
|
30
30
|
def open(&block)
|
31
|
-
|
31
|
+
raise Vedeu::Error::RequiresBlock unless block_given?
|
32
32
|
|
33
33
|
if raw_mode? || fake_mode?
|
34
34
|
console.raw { initialize_screen(mode) { yield } }
|
data/lib/vedeu/version.rb
CHANGED
data/lib/vedeu/views/chars.rb
CHANGED
@@ -45,9 +45,9 @@ module Vedeu
|
|
45
45
|
end
|
46
46
|
|
47
47
|
else
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
raise Vedeu::Error::InvalidSyntax,
|
49
|
+
'Cannot coerce for Vedeu::View::Chars, as collection is ' \
|
50
|
+
'unrecognised.'
|
51
51
|
|
52
52
|
end
|
53
53
|
end
|
data/lib/vedeu/views/line.rb
CHANGED
data/lib/vedeu/views/lines.rb
CHANGED
@@ -36,9 +36,9 @@ module Vedeu
|
|
36
36
|
new([collection], parent, name)
|
37
37
|
|
38
38
|
else
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
raise Vedeu::Error::InvalidSyntax,
|
40
|
+
'Cannot coerce for Vedeu::View::Lines, as collection ' \
|
41
|
+
'unrecognised.'
|
42
42
|
|
43
43
|
end
|
44
44
|
end
|
data/lib/vedeu/views/stream.rb
CHANGED
data/lib/vedeu/views/streams.rb
CHANGED
@@ -47,9 +47,9 @@ module Vedeu
|
|
47
47
|
new([Vedeu::Views::Stream.new(value: collection)], parent, name)
|
48
48
|
|
49
49
|
else
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
raise Vedeu::Error::InvalidSyntax,
|
51
|
+
'Cannot coerce for Vedeu::View::Streams, as collection ' \
|
52
|
+
"unrecognised. (#{collection.class.name})"
|
53
53
|
|
54
54
|
end
|
55
55
|
end
|
data/lib/vedeu/views/view.rb
CHANGED
@@ -208,6 +208,8 @@ module Vedeu
|
|
208
208
|
|
209
209
|
subject { instance.numeric?(_value) }
|
210
210
|
|
211
|
+
it { instance.must_respond_to(:fixnum?) }
|
212
|
+
|
211
213
|
context 'when the value is numeric' do
|
212
214
|
let(:_value) { 16 }
|
213
215
|
|
@@ -219,6 +221,31 @@ module Vedeu
|
|
219
221
|
end
|
220
222
|
end
|
221
223
|
|
224
|
+
describe '#positionable?' do
|
225
|
+
subject { instance.positionable?(_value) }
|
226
|
+
|
227
|
+
context 'when it does not respond to position' do
|
228
|
+
let(:_value) { '' }
|
229
|
+
|
230
|
+
it { subject.must_equal(false) }
|
231
|
+
end
|
232
|
+
|
233
|
+
context 'when it responds to position' do
|
234
|
+
let(:_value) { Vedeu::Cells::Empty.new(position: position) }
|
235
|
+
let(:position) { false }
|
236
|
+
|
237
|
+
context 'when the position is a Vedeu::Geometries::Position' do
|
238
|
+
let(:position) { Vedeu::Geometries::Position.new }
|
239
|
+
|
240
|
+
it { subject.must_equal(true) }
|
241
|
+
end
|
242
|
+
|
243
|
+
context 'when the position is not a Vedeu::Geometries::Position' do
|
244
|
+
it { subject.must_equal(false) }
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
222
249
|
describe '#present?' do
|
223
250
|
subject { instance.defined_value_test(_value) }
|
224
251
|
|
@@ -328,6 +355,22 @@ module Vedeu
|
|
328
355
|
end
|
329
356
|
end
|
330
357
|
|
358
|
+
describe '#symbol?' do
|
359
|
+
let(:_value) {}
|
360
|
+
|
361
|
+
subject { instance.symbol?(_value) }
|
362
|
+
|
363
|
+
context 'when the value is a Symbol' do
|
364
|
+
let(:_value) { :test }
|
365
|
+
|
366
|
+
it { subject.must_equal(true) }
|
367
|
+
end
|
368
|
+
|
369
|
+
context 'when the value is not a Symbol' do
|
370
|
+
it { subject.must_equal(false) }
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
331
374
|
describe '#truthy?' do
|
332
375
|
subject { instance.truthy?(_value) }
|
333
376
|
|