fedux_org-stdlib 0.0.28 → 0.0.29
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.
- data/README.md +1 -0
- data/doc/colors.md +13 -0
- data/lib/fedux_org/stdlib/colors/html_color.rb +19 -0
- data/lib/fedux_org/stdlib/version.rb +1 -1
- data/spec/colors/html_color_spec.rb +32 -0
- metadata +6 -2
data/README.md
CHANGED
data/doc/colors.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module FeduxOrg
|
2
|
+
module Stdlib
|
3
|
+
module Colors
|
4
|
+
class HtmlColor
|
5
|
+
# @param [String] color
|
6
|
+
# string in the html color format
|
7
|
+
def initialize( color )
|
8
|
+
@color = color
|
9
|
+
@validator_regex = /^#[a-f0-9]{6}$/
|
10
|
+
end
|
11
|
+
|
12
|
+
# @return [true,false] color string is valid
|
13
|
+
def valid?
|
14
|
+
@validator_regex === @color
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fedux_org/stdlib/colors/html_color'
|
3
|
+
|
4
|
+
describe FeduxOrg::Stdlib::Colors::HtmlColor do
|
5
|
+
context '#valid?' do
|
6
|
+
|
7
|
+
it 'suceeds if string is valid html color' do
|
8
|
+
expect(
|
9
|
+
FeduxOrg::Stdlib::Colors::HtmlColor.new( '#11aa11' ).valid?
|
10
|
+
).to be_true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'fails if color does not start with #' do
|
14
|
+
expect(
|
15
|
+
FeduxOrg::Stdlib::Colors::HtmlColor.new( '111111' ).valid?
|
16
|
+
).to be_false
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'fails if length is invalid' do
|
20
|
+
expect(
|
21
|
+
FeduxOrg::Stdlib::Colors::HtmlColor.new( '#111111111' ).valid?
|
22
|
+
).to be_false
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'fails if no hex number is given' do
|
26
|
+
expect(
|
27
|
+
FeduxOrg::Stdlib::Colors::HtmlColor.new( '#ZZAAZZ' ).valid?
|
28
|
+
).to be_false
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.29
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -76,10 +76,12 @@ files:
|
|
76
76
|
- README.md
|
77
77
|
- RELEASE_NOTES.md
|
78
78
|
- Rakefile
|
79
|
+
- doc/colors.md
|
79
80
|
- doc/logic_converters.md
|
80
81
|
- doc/models.md
|
81
82
|
- fedux_org-stdlib.gemspec
|
82
83
|
- lib/fedux_org/stdlib.rb
|
84
|
+
- lib/fedux_org/stdlib/colors/html_color.rb
|
83
85
|
- lib/fedux_org/stdlib/command.rb
|
84
86
|
- lib/fedux_org/stdlib/command/command_result.rb
|
85
87
|
- lib/fedux_org/stdlib/environment.rb
|
@@ -123,6 +125,7 @@ files:
|
|
123
125
|
- rakefiles/travis.rake
|
124
126
|
- script/console
|
125
127
|
- script/terminal
|
128
|
+
- spec/colors/html_color_spec.rb
|
126
129
|
- spec/command_spec.rb
|
127
130
|
- spec/examples/models/class_based/forbidden_keyword.rb
|
128
131
|
- spec/examples/models/class_based/ignore/ignored.rb
|
@@ -168,6 +171,7 @@ signing_key:
|
|
168
171
|
specification_version: 3
|
169
172
|
summary: collection of useful libraries
|
170
173
|
test_files:
|
174
|
+
- spec/colors/html_color_spec.rb
|
171
175
|
- spec/command_spec.rb
|
172
176
|
- spec/examples/models/class_based/forbidden_keyword.rb
|
173
177
|
- spec/examples/models/class_based/ignore/ignored.rb
|