vedeu 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/views/_interfaces.rb +127 -0
- data/examples/views/empty_template.rb +10 -0
- data/examples/views/expected/vedeu_full_screen.html +140 -0
- data/examples/views/expected/vedeu_full_screen.json +96050 -0
- data/examples/views/expected/vedeu_full_screen.out +1 -0
- data/examples/views/expected/vedeu_full_screen.txt +50 -0
- data/examples/views/expected/vedeu_line.html +140 -0
- data/examples/views/expected/vedeu_line.json +96050 -0
- data/examples/views/expected/vedeu_line.out +1 -0
- data/examples/views/expected/vedeu_line.txt +58 -0
- data/examples/views/expected/vedeu_lines.html +140 -0
- data/examples/views/expected/vedeu_lines.json +96050 -0
- data/examples/views/expected/{lines.out → vedeu_lines.out} +1 -1
- data/examples/views/expected/vedeu_lines_alignment.html +80 -0
- data/examples/views/expected/vedeu_lines_alignment.json +46370 -0
- data/examples/views/expected/vedeu_lines_alignment.out +1 -0
- data/examples/views/full_screen.rb +10 -0
- data/examples/views/line.rb +11 -106
- data/examples/views/lines.rb +8 -127
- data/examples/views/lines_alignment.rb +17 -125
- data/examples/views/runner.sh +65 -19
- data/lib/vedeu/borders/border.rb +6 -6
- data/lib/vedeu/borders/refresh.rb +4 -6
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/terminal.rb +4 -4
- data/lib/vedeu/buffers/view.rb +2 -2
- data/lib/vedeu/cells/all.rb +2 -2
- data/lib/vedeu/cells/border.rb +5 -0
- data/lib/vedeu/cells/borders/all.rb +2 -8
- data/lib/vedeu/cells/borders/edges/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_horizontal.rb → edges/bottom_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/{left_vertical.rb → edges/left_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{right_vertical.rb → edges/right_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{top_horizontal.rb → edges/top_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/horizontal.rb +5 -0
- data/lib/vedeu/cells/borders/vertical.rb +5 -0
- data/lib/vedeu/cells/borders/vertices/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_left.rb → vertices/bottom_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{bottom_right.rb → vertices/bottom_right.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_left.rb → vertices/top_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_right.rb → vertices/top_right.rb} +5 -0
- data/lib/vedeu/cells/char.rb +16 -0
- data/lib/vedeu/cells/clear.rb +5 -0
- data/lib/vedeu/cells/cursor.rb +70 -0
- data/lib/vedeu/cells/empty.rb +24 -14
- data/lib/vedeu/cells/escape.rb +8 -7
- data/lib/vedeu/cells/support/all.rb +3 -0
- data/lib/vedeu/cells/support/html.rb +98 -0
- data/lib/vedeu/colours/background.rb +21 -1
- data/lib/vedeu/colours/colour.rb +10 -2
- data/lib/vedeu/colours/foreground.rb +21 -1
- data/lib/vedeu/colours/translator.rb +17 -24
- data/lib/vedeu/colours/validator.rb +9 -9
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/cursors/cursor.rb +5 -5
- data/lib/vedeu/dsl/elements.rb +22 -79
- data/lib/vedeu/dsl/string/text.rb +3 -3
- data/lib/vedeu/editor/cropper.rb +2 -2
- data/lib/vedeu/editor/cursor.rb +1 -1
- data/lib/vedeu/editor/document.rb +1 -1
- data/lib/vedeu/geometries/area/dimension.rb +1 -1
- data/lib/vedeu/geometries/position.rb +5 -2
- data/lib/vedeu/interfaces/clear.rb +5 -5
- data/lib/vedeu/models/row.rb +4 -3
- data/lib/vedeu/output/compressor.rb +7 -7
- data/lib/vedeu/output/output.rb +8 -13
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/presentation/background.rb +2 -2
- data/lib/vedeu/presentation/colour.rb +0 -4
- data/lib/vedeu/presentation/foreground.rb +2 -2
- data/lib/vedeu/presentation/style.rb +1 -1
- data/lib/vedeu/presentation/styles.rb +0 -3
- data/lib/vedeu/renderers/file.rb +10 -68
- data/lib/vedeu/renderers/html.rb +28 -96
- data/lib/vedeu/renderers/json.rb +15 -31
- data/lib/vedeu/renderers/options.rb +160 -14
- data/lib/vedeu/renderers/templates/html_renderer.vedeu +1 -0
- data/lib/vedeu/renderers/terminal.rb +16 -17
- data/lib/vedeu/renderers/text.rb +32 -41
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/all.rb +0 -2
- data/lib/vedeu/views/chars.rb +6 -3
- data/lib/vedeu/views/stream.rb +3 -2
- data/test/lib/vedeu/borders/caption_test.rb +17 -17
- data/test/lib/vedeu/borders/title_test.rb +12 -12
- data/test/lib/vedeu/cells/border_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_horizontal_test.rb → edges/bottom_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{left_vertical_test.rb → edges/left_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{right_vertical_test.rb → edges/right_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{top_horizontal_test.rb → edges/top_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/horizontal_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/vertical_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_left_test.rb → vertices/bottom_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_right_test.rb → vertices/bottom_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_left_test.rb → vertices/top_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_right_test.rb → vertices/top_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/char_test.rb +18 -0
- data/test/lib/vedeu/cells/clear_test.rb +6 -0
- data/test/lib/vedeu/cells/cursor_test.rb +113 -0
- data/test/lib/vedeu/cells/empty_test.rb +100 -7
- data/test/lib/vedeu/cells/escape_test.rb +29 -13
- data/test/lib/vedeu/cells/support/html_test.rb +100 -0
- data/test/lib/vedeu/colours/background_test.rb +35 -3
- data/test/lib/vedeu/colours/colour_test.rb +66 -0
- data/test/lib/vedeu/colours/foreground_test.rb +35 -3
- data/test/lib/vedeu/colours/translator_test.rb +0 -34
- data/test/lib/vedeu/colours/validator_test.rb +84 -6
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/refresh_test.rb +4 -1
- data/test/lib/vedeu/dsl/string/text_test.rb +36 -36
- data/test/lib/vedeu/editor/cropper_test.rb +15 -15
- data/test/lib/vedeu/geometries/position_test.rb +14 -1
- data/test/lib/vedeu/models/page_test.rb +10 -10
- data/test/lib/vedeu/models/row_test.rb +7 -7
- data/test/lib/vedeu/output/compressor_test.rb +63 -50
- data/test/lib/vedeu/renderers/file_test.rb +64 -35
- data/test/lib/vedeu/renderers/html_test.rb +15 -12
- data/test/lib/vedeu/renderers/json_test.rb +79 -56
- data/test/lib/vedeu/renderers/options_test.rb +74 -26
- data/test/lib/vedeu/renderers/terminal_test.rb +34 -4
- data/test/lib/vedeu/renderers/text_test.rb +35 -3
- data/test/lib/vedeu/views/chars_test.rb +6 -0
- metadata +50 -41
- data/examples/views/expected/line.out +0 -1
- data/examples/views/expected/lines_alignment.out +0 -1
- data/lib/vedeu/cells/html.rb +0 -21
- data/lib/vedeu/cells/json.rb +0 -21
- data/lib/vedeu/views/char.rb +0 -180
- data/lib/vedeu/views/html_char.rb +0 -133
- data/test/lib/vedeu/cells/html_test.rb +0 -15
- data/test/lib/vedeu/cells/json_test.rb +0 -15
- data/test/lib/vedeu/views/char_test.rb +0 -283
- data/test/lib/vedeu/views/html_char_test.rb +0 -125
data/lib/vedeu/cells/empty.rb
CHANGED
@@ -27,6 +27,13 @@ module Vedeu
|
|
27
27
|
# @return [String]
|
28
28
|
attr_reader :value
|
29
29
|
|
30
|
+
# Returns the value represented as HTML.
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
def as_html
|
34
|
+
' '
|
35
|
+
end
|
36
|
+
|
30
37
|
# @return [Boolean]
|
31
38
|
def cell?
|
32
39
|
true
|
@@ -49,27 +56,30 @@ module Vedeu
|
|
49
56
|
' '
|
50
57
|
end
|
51
58
|
|
52
|
-
# @return [Hash]
|
53
|
-
def
|
59
|
+
# @return [Hash<Symbol => Hash<Symbol => String>, String>]
|
60
|
+
def to_h
|
54
61
|
{
|
55
|
-
|
56
|
-
style:
|
57
|
-
|
58
|
-
|
59
|
-
}
|
62
|
+
name: name.to_s,
|
63
|
+
style: style.to_s,
|
64
|
+
type: type,
|
65
|
+
value: value.to_s,
|
66
|
+
}.merge!(colour.to_h).merge!(position.to_h)
|
60
67
|
end
|
68
|
+
alias_method :to_hash, :to_h
|
61
69
|
|
62
|
-
#
|
70
|
+
# Returns the object represented as HTML.
|
71
|
+
#
|
72
|
+
# @param options [Hash] Options provided by
|
73
|
+
# {Vedeu::Renderers::HTML}.
|
63
74
|
# @return [String]
|
64
|
-
def to_html(
|
65
|
-
|
75
|
+
def to_html(options = {})
|
76
|
+
Vedeu::Cells::HTML.new(self, options).to_html
|
66
77
|
end
|
67
78
|
|
68
|
-
# @return [
|
69
|
-
def
|
70
|
-
|
79
|
+
# @return [Symbol]
|
80
|
+
def type
|
81
|
+
:empty
|
71
82
|
end
|
72
|
-
alias_method :to_str, :to_s
|
73
83
|
|
74
84
|
private
|
75
85
|
|
data/lib/vedeu/cells/escape.rb
CHANGED
@@ -40,7 +40,10 @@ module Vedeu
|
|
40
40
|
#
|
41
41
|
# @return [Hash<void>]
|
42
42
|
def to_h
|
43
|
-
{
|
43
|
+
{
|
44
|
+
type: type,
|
45
|
+
value: value,
|
46
|
+
}
|
44
47
|
end
|
45
48
|
alias_method :to_hash, :to_h
|
46
49
|
|
@@ -55,15 +58,13 @@ module Vedeu
|
|
55
58
|
|
56
59
|
# @return [String]
|
57
60
|
def to_s
|
58
|
-
|
61
|
+
value
|
59
62
|
end
|
60
63
|
alias_method :to_str, :to_s
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
def defaults
|
66
|
-
super.merge!(position: [1, 1], value: '')
|
65
|
+
# @return [Symbol]
|
66
|
+
def type
|
67
|
+
:escape
|
67
68
|
end
|
68
69
|
|
69
70
|
end # Escape
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Cells
|
4
|
+
|
5
|
+
# Presents a {Vedeu::Cells} member class as a HTML string.
|
6
|
+
#
|
7
|
+
# @api private
|
8
|
+
#
|
9
|
+
class HTML
|
10
|
+
|
11
|
+
include Vedeu::Common
|
12
|
+
|
13
|
+
# @param cell [void] The {Vedeu::Cells} class to be presented as
|
14
|
+
# HTML.
|
15
|
+
# @param options [Hash] Options provided by
|
16
|
+
# {Vedeu::Renderers::HTML}.
|
17
|
+
# @return [Vedeu::Cells::HTML]
|
18
|
+
def initialize(cell, options = {})
|
19
|
+
@cell = cell
|
20
|
+
@options = options || {}
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
def to_html
|
25
|
+
"#{start_tag}#{style_attribute}>#{value}#{end_tag}"
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
# @!attribute [r] cell
|
31
|
+
# @return [void]
|
32
|
+
attr_reader :cell
|
33
|
+
|
34
|
+
# @!attribute [r] options
|
35
|
+
# @return [Hash]
|
36
|
+
attr_reader :options
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
def background
|
42
|
+
if cell.respond_to?(:background)
|
43
|
+
cell.background.to_html
|
44
|
+
|
45
|
+
else
|
46
|
+
''
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [String]
|
52
|
+
def end_tag
|
53
|
+
options.fetch(:end_tag, '</td>')
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [String]
|
57
|
+
def foreground
|
58
|
+
if cell.respond_to?(:foreground)
|
59
|
+
cell.foreground.to_html
|
60
|
+
|
61
|
+
else
|
62
|
+
''
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [String]
|
68
|
+
def start_tag
|
69
|
+
options.fetch(:start_tag, '<td')
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [String]
|
73
|
+
def style_attribute
|
74
|
+
if absent?(background) && absent?(foreground)
|
75
|
+
''
|
76
|
+
|
77
|
+
else
|
78
|
+
" style='#{background}#{foreground}'"
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return [String]
|
84
|
+
def value
|
85
|
+
if cell.respond_to?(:as_html) && present?(cell.as_html)
|
86
|
+
cell.as_html
|
87
|
+
|
88
|
+
else
|
89
|
+
' '
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end # HTML
|
95
|
+
|
96
|
+
end # Cells
|
97
|
+
|
98
|
+
end # Vedeu
|
@@ -17,6 +17,26 @@ module Vedeu
|
|
17
17
|
present?(to_s)
|
18
18
|
end
|
19
19
|
|
20
|
+
# @return [Hash<Symbol => String>]
|
21
|
+
def to_h
|
22
|
+
{
|
23
|
+
background: colour.to_s
|
24
|
+
}
|
25
|
+
end
|
26
|
+
alias_method :to_hash, :to_h
|
27
|
+
|
28
|
+
# @param _options [Hash] Ignored.
|
29
|
+
# @return [String]
|
30
|
+
def to_html(_options = {})
|
31
|
+
if rgb?
|
32
|
+
"background-color:#{colour};"
|
33
|
+
|
34
|
+
else
|
35
|
+
''
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
20
40
|
private
|
21
41
|
|
22
42
|
# @return [String]
|
@@ -31,7 +51,7 @@ module Vedeu
|
|
31
51
|
# {Vedeu::EscapeSequences::Esc#valid_codes}
|
32
52
|
#
|
33
53
|
# @return [String]
|
34
|
-
def
|
54
|
+
def named
|
35
55
|
Vedeu.esc.background_colour(colour)
|
36
56
|
end
|
37
57
|
|
data/lib/vedeu/colours/colour.rb
CHANGED
@@ -87,7 +87,7 @@ module Vedeu
|
|
87
87
|
|
88
88
|
# An object is equal when its values are the same.
|
89
89
|
#
|
90
|
-
# @param other [
|
90
|
+
# @param other [void]
|
91
91
|
# @return [Boolean]
|
92
92
|
def eql?(other)
|
93
93
|
self.class == other.class && background == other.background &&
|
@@ -108,12 +108,20 @@ module Vedeu
|
|
108
108
|
@_foreground = @foreground = Vedeu::Colours::Foreground.coerce(value)
|
109
109
|
end
|
110
110
|
|
111
|
+
# @return [Hash<Symbol => Hash<Symbol => String>>]
|
112
|
+
def to_h
|
113
|
+
{
|
114
|
+
colour: background.to_h.merge!(foreground.to_h)
|
115
|
+
}
|
116
|
+
end
|
117
|
+
alias_method :to_hash, :to_h
|
118
|
+
|
111
119
|
# Returns both or either of the converted attributes into a
|
112
120
|
# single escape sequence.
|
113
121
|
#
|
114
122
|
# @return [String]
|
115
123
|
def to_s
|
116
|
-
foreground
|
124
|
+
"#{foreground}#{background}"
|
117
125
|
end
|
118
126
|
alias_method :to_str, :to_s
|
119
127
|
|
@@ -17,6 +17,26 @@ module Vedeu
|
|
17
17
|
present?(to_s)
|
18
18
|
end
|
19
19
|
|
20
|
+
# @return [Hash<Symbol => String>]
|
21
|
+
def to_h
|
22
|
+
{
|
23
|
+
foreground: colour.to_s
|
24
|
+
}
|
25
|
+
end
|
26
|
+
alias_method :to_hash, :to_h
|
27
|
+
|
28
|
+
# @param _options [Hash] Ignored.
|
29
|
+
# @return [String]
|
30
|
+
def to_html(_options = {})
|
31
|
+
if rgb?
|
32
|
+
"color:#{colour};"
|
33
|
+
|
34
|
+
else
|
35
|
+
''
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
20
40
|
private
|
21
41
|
|
22
42
|
# @return [String]
|
@@ -31,7 +51,7 @@ module Vedeu
|
|
31
51
|
# {Vedeu::EscapeSequences::Esc#valid_codes}
|
32
52
|
#
|
33
53
|
# @return [String]
|
34
|
-
def
|
54
|
+
def named
|
35
55
|
Vedeu.esc.foreground_colour(colour)
|
36
56
|
end
|
37
57
|
|
@@ -38,7 +38,7 @@ module Vedeu
|
|
38
38
|
def_delegators :validator,
|
39
39
|
:named?,
|
40
40
|
:rgb?,
|
41
|
-
:
|
41
|
+
:numbered?
|
42
42
|
|
43
43
|
# @!attribute [r] colour
|
44
44
|
# @return [String]
|
@@ -71,7 +71,7 @@ module Vedeu
|
|
71
71
|
|
72
72
|
# An object is equal when its values are the same.
|
73
73
|
#
|
74
|
-
# @param other [
|
74
|
+
# @param other [void]
|
75
75
|
# @return [Boolean]
|
76
76
|
def eql?(other)
|
77
77
|
self.class == other.class && colour == other.colour
|
@@ -89,11 +89,11 @@ module Vedeu
|
|
89
89
|
elsif rgb?
|
90
90
|
rgb
|
91
91
|
|
92
|
-
elsif
|
92
|
+
elsif numbered?
|
93
93
|
numbered
|
94
94
|
|
95
95
|
elsif named?
|
96
|
-
|
96
|
+
named
|
97
97
|
|
98
98
|
else
|
99
99
|
''
|
@@ -103,14 +103,6 @@ module Vedeu
|
|
103
103
|
alias_method :to_s, :escape_sequence
|
104
104
|
alias_method :to_str, :escape_sequence
|
105
105
|
|
106
|
-
# @param _options [Hash] Ignored.
|
107
|
-
# @return [String]
|
108
|
-
def to_html(_options = {})
|
109
|
-
return colour if rgb?
|
110
|
-
|
111
|
-
''
|
112
|
-
end
|
113
|
-
|
114
106
|
private
|
115
107
|
|
116
108
|
# Retrieves the escape sequence for the HTML/CSS colour code.
|
@@ -145,7 +137,14 @@ module Vedeu
|
|
145
137
|
#
|
146
138
|
# @return [String]
|
147
139
|
def numbered
|
148
|
-
|
140
|
+
format(numbered_prefix, colour)
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns an escape sequence.
|
144
|
+
#
|
145
|
+
# @return [String]
|
146
|
+
def numbered_prefix
|
147
|
+
"#{prefix}5;%sm"
|
149
148
|
end
|
150
149
|
|
151
150
|
# Returns an escape sequence.
|
@@ -155,12 +154,12 @@ module Vedeu
|
|
155
154
|
if registered?(colour)
|
156
155
|
retrieve(colour)
|
157
156
|
|
157
|
+
elsif [8, 16, 256].include?(Vedeu.config.colour_mode)
|
158
|
+
register(colour, format(numbered_prefix, css_to_numbered))
|
159
|
+
|
158
160
|
elsif Vedeu.config.colour_mode == 16_777_216
|
159
161
|
register(colour, format(rgb_prefix, *css_to_rgb))
|
160
162
|
|
161
|
-
else
|
162
|
-
register(colour, numbered)
|
163
|
-
|
164
163
|
end
|
165
164
|
end
|
166
165
|
|
@@ -189,13 +188,7 @@ module Vedeu
|
|
189
188
|
|
190
189
|
# @return [Fixnum]
|
191
190
|
def css_to_numbered
|
192
|
-
|
193
|
-
[16, red, green, blue].inject(:+)
|
194
|
-
|
195
|
-
elsif within_range?
|
196
|
-
colour
|
197
|
-
|
198
|
-
end
|
191
|
+
[16, red, green, blue].inject(:+)
|
199
192
|
end
|
200
193
|
|
201
194
|
# Takes the red component of {#css_to_rgb} and converts to the
|
@@ -228,7 +221,7 @@ module Vedeu
|
|
228
221
|
def not_implemented
|
229
222
|
fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'
|
230
223
|
end
|
231
|
-
alias_method :
|
224
|
+
alias_method :named, :not_implemented
|
232
225
|
alias_method :repository, :not_implemented
|
233
226
|
|
234
227
|
# @return [Vedeu::Colours::Validator]
|
@@ -25,14 +25,6 @@ module Vedeu
|
|
25
25
|
@value = value
|
26
26
|
end
|
27
27
|
|
28
|
-
# Returns a boolean indicating whether the value is within the
|
29
|
-
# range of valid terminal numbered colours.
|
30
|
-
#
|
31
|
-
# @return [Boolean]
|
32
|
-
def within_range?
|
33
|
-
numeric?(value) && value >= 0 && value <= 255
|
34
|
-
end
|
35
|
-
|
36
28
|
# Returns a boolean indicating whether the colour provided is a
|
37
29
|
# valid named colour.
|
38
30
|
#
|
@@ -41,6 +33,14 @@ module Vedeu
|
|
41
33
|
Vedeu.esc.valid_name?(value)
|
42
34
|
end
|
43
35
|
|
36
|
+
# Returns a boolean indicating whether the value is within the
|
37
|
+
# range of valid terminal numbered colours.
|
38
|
+
#
|
39
|
+
# @return [Boolean]
|
40
|
+
def numbered?
|
41
|
+
numeric?(value) && value >= 0 && value <= 255
|
42
|
+
end
|
43
|
+
|
44
44
|
# Returns a boolean indicated whether the colour is a valid
|
45
45
|
# HTML/CSS colour.
|
46
46
|
#
|
@@ -53,7 +53,7 @@ module Vedeu
|
|
53
53
|
|
54
54
|
# @return [Boolean]
|
55
55
|
def valid?
|
56
|
-
background? || colour? || foreground? || rgb? || named? ||
|
56
|
+
background? || colour? || foreground? || rgb? || named? || numbered?
|
57
57
|
end
|
58
58
|
|
59
59
|
protected
|