vedeu 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/TODO.md +4 -0
  3. data/docs/dsl.md +1 -11
  4. data/docs/dsl/by_method/geometry/align.md +1 -0
  5. data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
  6. data/docs/dsl/by_method/geometry/align_centre.md +40 -0
  7. data/docs/dsl/by_method/geometry/align_left.md +40 -0
  8. data/docs/dsl/by_method/geometry/align_middle.md +40 -0
  9. data/docs/dsl/by_method/geometry/align_right.md +40 -0
  10. data/docs/dsl/by_method/geometry/align_top.md +40 -0
  11. data/docs/dsl/by_method/geometry/columns.md +1 -0
  12. data/docs/dsl/by_method/geometry/height.md +0 -0
  13. data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
  14. data/docs/dsl/by_method/geometry/rows.md +1 -0
  15. data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
  16. data/docs/dsl/by_method/geometry/width.md +0 -0
  17. data/docs/dsl/by_method/geometry/x.md +1 -0
  18. data/docs/dsl/by_method/geometry/xn.md +1 -0
  19. data/docs/dsl/by_method/geometry/y.md +1 -0
  20. data/docs/dsl/by_method/geometry/yn.md +1 -0
  21. data/docs/dsl/by_method/render.md +5 -1
  22. data/docs/dsl/by_method/renders.md +31 -1
  23. data/docs/dsl/by_method/view.md +26 -0
  24. data/docs/dsl/by_method/view/stream.md +18 -0
  25. data/docs/dsl/by_method/views.md +32 -1
  26. data/docs/events/by_name/set_border_caption.md +2 -4
  27. data/docs/events/by_name/set_border_title.md +2 -4
  28. data/examples/views/empty_template.rb +0 -4
  29. data/examples/views/full_screen.rb +30 -5
  30. data/examples/views/misc_view.rb +464 -0
  31. data/examples/views/wordwrap.rb +72 -0
  32. data/examples/views/wordwrap.txt +8 -0
  33. data/integrations/dsl_app_021.rb +127 -0
  34. data/integrations/dsl_app_022.rb +133 -0
  35. data/integrations/expected/342_streams.out +1 -1
  36. data/integrations/expected/dsl_app_001.out +1 -1
  37. data/integrations/expected/dsl_app_002.out +1 -1
  38. data/integrations/expected/dsl_app_003.out +1 -1
  39. data/integrations/expected/dsl_app_004.out +1 -1
  40. data/integrations/expected/dsl_app_005.out +1 -1
  41. data/integrations/expected/dsl_app_006.out +1 -1
  42. data/integrations/expected/dsl_app_007.out +1 -1
  43. data/integrations/expected/dsl_app_008.out +1 -1
  44. data/integrations/expected/dsl_app_009.out +1 -1
  45. data/integrations/expected/dsl_app_010.out +1 -1
  46. data/integrations/expected/dsl_app_011.out +1 -1
  47. data/integrations/expected/dsl_app_012.out +1 -1
  48. data/integrations/expected/dsl_app_013.out +1 -1
  49. data/integrations/expected/dsl_app_014.out +1 -1
  50. data/integrations/expected/dsl_app_015.out +1 -1
  51. data/integrations/expected/dsl_app_016.out +1 -1
  52. data/integrations/expected/dsl_app_021.out +1 -0
  53. data/integrations/expected/dsl_app_022.out +1 -0
  54. data/integrations/support/test_interface_021.rb +7 -0
  55. data/integrations/support/test_interface_022.rb +15 -0
  56. data/lib/vedeu/all.rb +4 -2
  57. data/lib/vedeu/borders/border.rb +22 -6
  58. data/lib/vedeu/borders/repository.rb +4 -8
  59. data/lib/vedeu/buffers/buffer.rb +9 -6
  60. data/lib/vedeu/buffers/empty.rb +26 -23
  61. data/lib/vedeu/buffers/view.rb +44 -41
  62. data/lib/vedeu/cells/cursor.rb +0 -2
  63. data/lib/vedeu/cells/empty.rb +0 -1
  64. data/lib/vedeu/cells/escape.rb +0 -2
  65. data/lib/vedeu/coercers/alignment.rb +58 -8
  66. data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
  67. data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
  68. data/lib/vedeu/common.rb +1 -1
  69. data/lib/vedeu/configuration/configuration.rb +41 -3
  70. data/lib/vedeu/cursors/coordinate.rb +1 -3
  71. data/lib/vedeu/cursors/cursor.rb +2 -6
  72. data/lib/vedeu/dsl/all.rb +1 -2
  73. data/lib/vedeu/dsl/border.rb +6 -6
  74. data/lib/vedeu/dsl/elements.rb +2 -2
  75. data/lib/vedeu/dsl/geometry.rb +7 -7
  76. data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
  77. data/lib/vedeu/dsl/helpers/all.rb +17 -0
  78. data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
  79. data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
  80. data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
  81. data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
  82. data/lib/vedeu/dsl/view.rb +11 -19
  83. data/lib/vedeu/dsl/views.rb +16 -106
  84. data/lib/vedeu/geometries/all.rb +0 -1
  85. data/lib/vedeu/geometries/area/area.rb +6 -12
  86. data/lib/vedeu/geometries/area/dimension.rb +21 -44
  87. data/lib/vedeu/geometries/dsl/all.rb +0 -1
  88. data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
  89. data/lib/vedeu/geometries/geometry.rb +6 -0
  90. data/lib/vedeu/geometries/position.rb +6 -3
  91. data/lib/vedeu/geometries/repository.rb +1 -1
  92. data/lib/vedeu/input/mouse.rb +1 -0
  93. data/lib/vedeu/logging/log.rb +3 -6
  94. data/lib/vedeu/menus/dsl.rb +4 -5
  95. data/lib/vedeu/output/compressor.rb +11 -1
  96. data/lib/vedeu/output/viewport.rb +59 -59
  97. data/lib/vedeu/presentation/all.rb +1 -2
  98. data/lib/vedeu/presentation/colour.rb +75 -3
  99. data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
  100. data/lib/vedeu/presentation/presentation.rb +1 -3
  101. data/lib/vedeu/presentation/styles.rb +16 -1
  102. data/lib/vedeu/repositories/all.rb +0 -1
  103. data/lib/vedeu/sentence.rb +91 -0
  104. data/lib/vedeu/support/point.rb +72 -0
  105. data/lib/vedeu/terminal/terminal.rb +11 -53
  106. data/lib/vedeu/version.rb +1 -1
  107. data/lib/vedeu/views/composition.rb +11 -1
  108. data/lib/vedeu/views/default_attributes.rb +2 -0
  109. data/lib/vedeu/views/line.rb +16 -1
  110. data/lib/vedeu/views/stream.rb +16 -1
  111. data/lib/vedeu/views/view.rb +25 -17
  112. data/test/lib/vedeu/borders/border_test.rb +20 -2
  113. data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
  114. data/test/lib/vedeu/buffers/empty_test.rb +51 -18
  115. data/test/lib/vedeu/buffers/view_test.rb +2 -2
  116. data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
  117. data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
  118. data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
  119. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  120. data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
  121. data/test/lib/vedeu/dsl/elements_test.rb +94 -2
  122. data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
  123. data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
  124. data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
  125. data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
  126. data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
  127. data/test/lib/vedeu/dsl/view_test.rb +22 -4
  128. data/test/lib/vedeu/dsl/views_test.rb +8 -5
  129. data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
  130. data/test/lib/vedeu/geometries/position_test.rb +118 -60
  131. data/test/lib/vedeu/input/mouse_test.rb +1 -6
  132. data/test/lib/vedeu/logging/log_test.rb +14 -3
  133. data/test/lib/vedeu/presentation/colour_test.rb +77 -0
  134. data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
  135. data/test/lib/vedeu/sentence_test.rb +49 -0
  136. data/test/lib/vedeu/support/point_test.rb +139 -0
  137. data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
  138. data/test/lib/vedeu/views/composition_test.rb +24 -4
  139. data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
  140. data/test/lib/vedeu/views/view_test.rb +8 -15
  141. data/test/support/examples/material_colours_app.rb +0 -6
  142. data/vedeu.gemspec +1 -1
  143. metadata +58 -38
  144. data/examples/views/lines_line_stream.rb +0 -95
  145. data/examples/views/lines_line_streams.rb +0 -75
  146. data/examples/views/lines_line_streams_stream.rb +0 -78
  147. data/examples/views/lines_line_streams_stream_stream.rb +0 -50
  148. data/examples/views/lines_streams.rb +0 -93
  149. data/lib/vedeu/dsl/string/all.rb +0 -16
  150. data/lib/vedeu/geometries/dsl/validator.rb +0 -62
  151. data/lib/vedeu/presentation/background.rb +0 -54
  152. data/lib/vedeu/presentation/foreground.rb +0 -54
  153. data/lib/vedeu/repositories/parent.rb +0 -34
  154. data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
  155. data/test/lib/vedeu/presentation/background_test.rb +0 -74
  156. data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -67,48 +67,14 @@ module Vedeu
67
67
 
68
68
  private
69
69
 
70
- # @return [Array<Array<Vedeu::Cells::Char>>]
71
- def output
72
- Vedeu.timer("Rendering content: '#{name}'") do
73
- out = []
74
-
75
- show.each_with_index do |line, iy|
76
- line.each_with_index do |column, ix|
77
- column.position = [by + iy, bx + ix]
78
- out << column
79
- end
80
- end
81
-
82
- out
83
- end
84
- end
85
-
86
- # Returns the visible content for the view.
87
- #
88
- # @note If there are no lines of content, we return an empty
89
- # array. If there are no more columns of content we return a
90
- # space enclosed in an array; this prevents a weird line
91
- # hopping bug which occurs when the current line has no more
92
- # content, but subsequent lines do.
93
- #
94
- # @return [Array]
95
- def show
96
- (lines[rows] || []).map { |line| (line.chars[columns] || []) }
70
+ # @return [Fixnum]
71
+ def bx
72
+ @bx ||= geometry.bx
97
73
  end
98
74
 
99
- # Using the current cursor's y position, return a range of
100
- # visible lines.
101
- #
102
- # Scrolls the content vertically when the stored cursor's y
103
- # position for the interface is outside of the visible area.
104
- #
105
- # @note
106
- # The height is reduced by one as #rows is a range of Array
107
- # elements.
108
- #
109
- # @return [Range]
110
- def rows
111
- top...(top + bordered_height)
75
+ # @return [Fixnum]
76
+ def by
77
+ @by ||= geometry.by
112
78
  end
113
79
 
114
80
  # Using the current cursor's x position, return a range of
@@ -126,16 +92,6 @@ module Vedeu
126
92
  left...(left + bordered_width)
127
93
  end
128
94
 
129
- # @return [Fixnum]
130
- def left
131
- @left ||= content_offset(ox, bordered_width)
132
- end
133
-
134
- # @return [Fixnum]
135
- def top
136
- @top ||= content_offset(oy, bordered_height)
137
- end
138
-
139
95
  # Returns the offset for the content (the number of rows or
140
96
  # columns to change the viewport by on either the y or x axis)
141
97
  # determined by the offset (the cursor's y or x offset position.
@@ -149,6 +105,12 @@ module Vedeu
149
105
  offset - dimension
150
106
  end
151
107
 
108
+ # @return [Vedeu::Cursors::Cursor]
109
+ # @see Vedeu::Cursors::Repository#by_name
110
+ def cursor
111
+ @cursor ||= Vedeu.cursors.by_name(name)
112
+ end
113
+
152
114
  # Returns the geometry for the interface.
153
115
  #
154
116
  # @return (see Vedeu::Geometries::Repository#by_name)
@@ -157,19 +119,57 @@ module Vedeu
157
119
  end
158
120
 
159
121
  # @return [Fixnum]
160
- def bx
161
- @bx ||= geometry.bx
122
+ def left
123
+ @left ||= content_offset(ox, bordered_width)
162
124
  end
163
125
 
164
- # @return [Fixnum]
165
- def by
166
- @by ||= geometry.by
126
+ # @return [Array<Array<Vedeu::Cells::Char>>]
127
+ def output
128
+ Vedeu.timer("Rendering content: '#{name}'") do
129
+ out = []
130
+
131
+ show.each_with_index do |line, iy|
132
+ line.each_with_index do |column, ix|
133
+ column.position = [by + iy, bx + ix]
134
+ out << column
135
+ end
136
+ end
137
+
138
+ out
139
+ end
167
140
  end
168
141
 
169
- # @return [Vedeu::Cursors::Cursor]
170
- # @see Vedeu::Cursors::Repository#by_name
171
- def cursor
172
- @cursor ||= Vedeu.cursors.by_name(name)
142
+ # Using the current cursor's y position, return a range of
143
+ # visible lines.
144
+ #
145
+ # Scrolls the content vertically when the stored cursor's y
146
+ # position for the interface is outside of the visible area.
147
+ #
148
+ # @note
149
+ # The height is reduced by one as #rows is a range of Array
150
+ # elements.
151
+ #
152
+ # @return [Range]
153
+ def rows
154
+ top...(top + bordered_height)
155
+ end
156
+
157
+ # Returns the visible content for the view.
158
+ #
159
+ # @note If there are no lines of content, we return an empty
160
+ # array. If there are no more columns of content we return a
161
+ # space enclosed in an array; this prevents a weird line
162
+ # hopping bug which occurs when the current line has no more
163
+ # content, but subsequent lines do.
164
+ #
165
+ # @return [Array]
166
+ def show
167
+ (lines[rows] || []).map { |line| (line.chars[columns] || []) }
168
+ end
169
+
170
+ # @return [Fixnum]
171
+ def top
172
+ @top ||= content_offset(oy, bordered_height)
173
173
  end
174
174
 
175
175
  end # Viewport
@@ -11,9 +11,8 @@ module Vedeu
11
11
 
12
12
  end # Vedeu
13
13
 
14
- require 'vedeu/presentation/background'
15
- require 'vedeu/presentation/foreground'
16
14
  require 'vedeu/presentation/colour'
15
+ require 'vedeu/presentation/position'
17
16
  require 'vedeu/presentation/styles'
18
17
  require 'vedeu/presentation/style'
19
18
  require 'vedeu/presentation/presentation'
@@ -10,9 +10,35 @@ module Vedeu
10
10
  #
11
11
  module Colour
12
12
 
13
- include Vedeu::Repositories::Parent
14
- include Vedeu::Presentation::Colour::Background
15
- include Vedeu::Presentation::Colour::Foreground
13
+ # When the background colour for the model exists, return it,
14
+ # otherwise returns the parent background colour, or an empty
15
+ # Vedeu::Colours::Background.
16
+ #
17
+ # @return [Vedeu::Colours::Background]
18
+ def background
19
+ @background ||= if colour && present?(colour.background)
20
+ colour.background
21
+
22
+ elsif named_colour?
23
+ named_colour.background
24
+
25
+ elsif parent && present?(parent.background)
26
+ parent.background
27
+
28
+ else
29
+ Vedeu::Colours::Background.new
30
+
31
+ end
32
+ end
33
+
34
+ # Allows the setting of the background colour by coercing the
35
+ # given value into a Vedeu::Colours::Background colour.
36
+ #
37
+ # @return [Vedeu::Colours::Background]
38
+ def background=(value)
39
+ @background = colour.background = value
40
+ @_colour = @colour = colour
41
+ end
16
42
 
17
43
  # @return [Vedeu::Colours::Colour]
18
44
  def colour
@@ -44,6 +70,52 @@ module Vedeu
44
70
  present?(@colour)
45
71
  end
46
72
 
73
+ # When the foreground colour for the model exists, return it,
74
+ # otherwise returns the parent foreground colour, or an empty
75
+ # Vedeu::Colours::Foreground.
76
+ #
77
+ # @return [Vedeu::Colours::Foreground]
78
+ def foreground
79
+ @foreground ||= if colour && present?(colour.foreground)
80
+ colour.foreground
81
+
82
+ elsif named_colour?
83
+ named_colour.foreground
84
+
85
+ elsif parent && present?(parent.foreground)
86
+ parent.foreground
87
+
88
+ else
89
+ Vedeu::Colours::Foreground.new
90
+
91
+ end
92
+ end
93
+
94
+ # Allows the setting of the foreground colour by coercing the
95
+ # given value into a Vedeu::Colours::Foreground colour.
96
+ #
97
+ # @return [Vedeu::Colours::Foreground]
98
+ def foreground=(value)
99
+ @foreground = colour.foreground = value
100
+ @_colour = @colour = colour
101
+ end
102
+
103
+ # @return [NilClass|void]
104
+ def parent
105
+ present?(@parent) ? @parent : nil
106
+ end
107
+
108
+ # @return [NilClass|String|Symbol]
109
+ def name
110
+ if present?(@name)
111
+ @name
112
+
113
+ elsif parent && present?(parent.name)
114
+ parent.name
115
+
116
+ end
117
+ end
118
+
47
119
  private
48
120
 
49
121
  # @return [Vedeu::Colours::Colour]
@@ -2,13 +2,13 @@
2
2
 
3
3
  module Vedeu
4
4
 
5
- module Geometries
5
+ module Presentation
6
6
 
7
7
  # Provide position functionality to the including model.
8
8
  #
9
9
  # @api private
10
10
  #
11
- module Positionable
11
+ module Position
12
12
 
13
13
  # Gets the position.
14
14
  #
@@ -50,8 +50,8 @@ module Vedeu
50
50
  position.y if position?
51
51
  end
52
52
 
53
- end # Positionable
53
+ end # Position
54
54
 
55
- end # Geometries
55
+ end # Presentation
56
56
 
57
57
  end # Vedeu
@@ -1,13 +1,11 @@
1
- require 'vedeu/geometries/positionable'
2
-
3
1
  # frozen_string_literal: true
4
2
 
5
3
  module Vedeu
6
4
 
7
5
  module Presentation
8
6
 
9
- include Vedeu::Geometries::Positionable
10
7
  include Vedeu::Presentation::Colour
8
+ include Vedeu::Presentation::Position
11
9
  include Vedeu::Presentation::Styles
12
10
 
13
11
  # Converts the colours and styles to escape sequences, and when
@@ -9,7 +9,22 @@ module Vedeu
9
9
  module Styles
10
10
 
11
11
  include Vedeu::Common
12
- include Vedeu::Repositories::Parent
12
+
13
+ # @return [NilClass|String|Symbol]
14
+ def name
15
+ if present?(@name)
16
+ @name
17
+
18
+ elsif parent && present?(parent.name)
19
+ parent.name
20
+
21
+ end
22
+ end
23
+
24
+ # @return [NilClass|void]
25
+ def parent
26
+ present?(@parent) ? @parent : nil
27
+ end
13
28
 
14
29
  # When the style for the model exists, return it, otherwise
15
30
  # returns the parent style, or an empty
@@ -15,7 +15,6 @@ require 'vedeu/repositories/collection'
15
15
  require 'vedeu/repositories/defaults'
16
16
  require 'vedeu/repositories/repositories'
17
17
  require 'vedeu/repositories/model'
18
- require 'vedeu/repositories/parent'
19
18
  require 'vedeu/repositories/store'
20
19
  require 'vedeu/repositories/registerable'
21
20
  require 'vedeu/repositories/repository'
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vedeu
4
+
5
+ # Converts the array of elements provided into a comma separated
6
+ # sentence with the penultimate and ultimate elements separated with
7
+ # the word 'and'.
8
+ #
9
+ class Sentence
10
+
11
+ # @param (see #initialize)
12
+ # @return (see #construct)
13
+ def self.construct(elements, label = 'elements')
14
+ new(elements, label).construct
15
+ end
16
+
17
+ # @param elements [Array]
18
+ # @param label [String]
19
+ # @return [Vedeu::Sentence]
20
+ def initialize(elements, label = 'elements')
21
+ @elements = elements
22
+ @label = label
23
+ end
24
+
25
+ # @return [String]
26
+ def construct
27
+ if one?
28
+ first
29
+
30
+ elsif two?
31
+ elements.join(' and ')
32
+
33
+ elsif many?
34
+ [but_last, last].join(' and ')
35
+
36
+ else
37
+ "No #{label} have been assigned."
38
+
39
+ end
40
+ end
41
+
42
+ protected
43
+
44
+ # @!attribute [r] elements
45
+ # @return [Array]
46
+ attr_reader :elements
47
+
48
+ # @!attribute [r] label
49
+ # @return [String]
50
+ attr_reader :label
51
+
52
+ private
53
+
54
+ # @return [Boolean]
55
+ def one?
56
+ count == 1
57
+ end
58
+
59
+ # @return [Boolean]
60
+ def two?
61
+ count == 2
62
+ end
63
+
64
+ # @return [Boolean]
65
+ def many?
66
+ count > 2
67
+ end
68
+
69
+ # @return [Array]
70
+ def but_last
71
+ elements[0...-1].join(', ')
72
+ end
73
+
74
+ # @return [void]
75
+ def first
76
+ elements.first
77
+ end
78
+
79
+ # @return [void]
80
+ def last
81
+ elements[-1]
82
+ end
83
+
84
+ # @return [Fixnum]
85
+ def count
86
+ elements.size
87
+ end
88
+
89
+ end # Sentence
90
+
91
+ end # Vedeu
@@ -0,0 +1,72 @@
1
+ module Vedeu
2
+
3
+ class Point
4
+
5
+ # @param (see #initialize)
6
+ # @return (see #initialize)
7
+ def self.coerce(value: nil, min: 1, max: nil)
8
+ new(value: value, min: min, max: max).coerce
9
+ end
10
+
11
+ # @param (see #initialize)
12
+ # @return (see #initialize)
13
+ def self.valid?(value: nil, min: 1, max: nil)
14
+ new(value: value, min: min, max: max).valid?
15
+ end
16
+
17
+ # @param value [Fixnum|NilClass]
18
+ # @param min [Fixnum]
19
+ # @param max [Fixnum]
20
+ # @return [Vedeu::Point]
21
+ def initialize(value: nil, min: 1, max: nil)
22
+ @min = min
23
+ @max = max
24
+ @value = value
25
+ end
26
+
27
+ # @return [Vedeu::Point]
28
+ def coerce
29
+ fail Vedeu::Error::InvalidSyntax,
30
+ "Expecting 'min' to be less than 'max'." if min > max
31
+
32
+ if value < min
33
+ Vedeu::Point.coerce(value: min, min: min, max: max)
34
+
35
+ elsif value > max
36
+ Vedeu::Point.coerce(value: max, min: min, max: max)
37
+
38
+ else
39
+ self
40
+
41
+ end
42
+ end
43
+
44
+ # @return [Boolean]
45
+ def valid?
46
+ @value.is_a?(Fixnum) && @value >= min && @value <= max
47
+ end
48
+
49
+ # @return [Fixnum]
50
+ def value
51
+ @value ||= min
52
+ end
53
+
54
+ private
55
+
56
+ # @return [Fixnum]
57
+ def min
58
+ return @min if @min.is_a?(Fixnum)
59
+
60
+ fail Vedeu::Error::InvalidSyntax, "Expecting 'min' to be a Fixnum."
61
+ end
62
+
63
+ # @return [Fixnum]
64
+ def max
65
+ return @max if @max.is_a?(Fixnum)
66
+
67
+ fail Vedeu::Error::InvalidSyntax, "Expecting 'max' to be a Fixnum."
68
+ end
69
+
70
+ end # Point
71
+
72
+ end # Vedeu