colos 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/colos/version.rb +1 -1
  3. data/lib/colos.rb +5 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d6002b341689f2e962e6ea37f5b4253b9c9401e
4
- data.tar.gz: 58dc81507dd9ababaa821e0b94c68d559e50b818
3
+ metadata.gz: 7122294595ee7cada3dcc8fcdcfc938fa0990bd5
4
+ data.tar.gz: 17f4022e8eb0110b5633192aa2e481743e6da170
5
5
  SHA512:
6
- metadata.gz: 97bf567c1a5b9e5a799005a816e1508ddca3e61b48bf045f89d963102e9b1cb0c5e02f3cc5f52aae91ff5258b9151a1d21d4b8198288f302477de5365af8e1b7
7
- data.tar.gz: 7e42eb147bc634a49759d3e5c9b117900ae1fc4f25b1cec3c3493ba8f5556190c2ce3feae743cb1c299c677bc24cd781acb9f6c41cd4e0208c9fcbb67f6e1e6e
6
+ metadata.gz: b46a0be11380cb35520335162cac5e528b82ce99859284c2e5f3e3ea3672a5d966a01fda6daad4edd4c1ce94518971de54d5dae5b01f85c60ad99c0669fde758
7
+ data.tar.gz: 10960ed5b12baf46e3d0c53cd9368fe935c03dd9d830c6e3d514c6bfac8c4378533391916336480bfcf2a66effd2c3bf36e397e6e80e3318eed2f2d75d114297
data/lib/colos/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Colos
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/colos.rb CHANGED
@@ -8,7 +8,7 @@ class Colos
8
8
  # Initializer
9
9
  #
10
10
  # Example:
11
- # >> Colos.new frequency: 1.2, randomizr: 12
11
+ # >> Colos.new frequency: 1.2, randomizr: 12, format: :hex
12
12
  # => Colos instance
13
13
  #
14
14
  # Arguments:
@@ -17,7 +17,8 @@ class Colos
17
17
  default_options = {
18
18
  hash: CityHash,
19
19
  frequency: 1.4,
20
- randomizr: 0
20
+ randomizr: 0,
21
+ format: :hex
21
22
  }
22
23
 
23
24
  # merge
@@ -27,6 +28,7 @@ class Colos
27
28
  raise "Frequency option should be from 1.2 to 1.6" unless (1.2..1.6).include? @options[:frequency]
28
29
  raise "Randomizr option should be from 0 to 23" unless (0..23).include? @options[:randomizr]
29
30
  raise "Hash class should have `new` method" unless @options[:hash].respond_to?('hash32')
31
+ raise "Format can be hex or rgb" unless [:hex, :rgb].include? @options[:format]
30
32
  end
31
33
 
32
34
  # Convert IPv4 to color
@@ -72,7 +74,7 @@ class Colos
72
74
  hex = ""
73
75
  color.each do |b|
74
76
  b = b.to_i.to_s 16
75
- b *= 2 unless b.size == 2
77
+ b = "0#{b}" unless b.size == 2
76
78
  hex += b
77
79
  end
78
80
  hexs << hex
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Artemev