hexer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/hexer.rb +32 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTgyMjA5YjdkMjdkOTMwODg1ZWI5YzMwMGEyZDZkMWZkYTFmY2Q5OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjBmNjU0Mzg5YmEyZmY3MTEyMmZiZjQwNjZlYTNhZGZjZWZkZmJiYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDgwYWJhNDdhNWZkYWI5NzRmNDczNWFjNWM4NmM2NDlhYWVmNjRiNTk2ZWQx
|
10
|
+
ZmYzZmRlYjhjOTgyYWI3MmNiMjMwOTRmYjc2M2UyYjk0YmYxZjNiZDc1NTM2
|
11
|
+
MTE3ZTgyNTQ2YWMxMGZjODBhMDQ4NmRhYzdjNmViZGJlZjgzMzA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
M2UyYWU4NTUzYzAyOGJmYjMzZGU5Y2E2ZTQwOWVmMGRiZDk1OWJkOTU4Yjcy
|
14
|
+
OTQyZjFmYzYyNmJjYjcxYjQzNDY5MTcwZDE5MjZlMTJhMzJhYzMzNWMzYzlh
|
15
|
+
NDFkNDg2MDk5OTY1ZjI4NTQyZWQ3MDQwMDgzODg5YzYzMDAxMTc=
|
data/lib/hexer.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
class Hex
|
2
|
+
def self.generate
|
3
|
+
"#{convert_rgb_to_hex}#{convert_rgb_to_hex}#{convert_rgb_to_hex}"
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.create_random_rgb
|
7
|
+
rand(0..255)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.convert_rgb_to_hex
|
11
|
+
random_rgb = create_random_rgb
|
12
|
+
|
13
|
+
first_hex_value = modify_raw_hex(random_rgb / 16)
|
14
|
+
second_hex_value = modify_raw_hex(random_rgb % 16)
|
15
|
+
|
16
|
+
"#{first_hex_value}#{second_hex_value}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.modify_raw_hex(generated_value)
|
20
|
+
if generated_value >= 10
|
21
|
+
convert_teens_to_hex(generated_value)
|
22
|
+
else
|
23
|
+
generated_value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.convert_teens_to_hex(generated_teen)
|
28
|
+
teens_hex = ['A', 'B', 'C', 'D', 'E', 'F']
|
29
|
+
|
30
|
+
teens_hex[generated_teen % 10]
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hexer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicole Paz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gem that generates a random hex color for a project. To use, simply
|
14
|
+
install, require, and type "Hex.generate".
|
15
|
+
email: nicole@mechlock.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/hexer.rb
|
21
|
+
homepage: http://rubygems.org/gems/hexer
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.1.3
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Hex colors
|
45
|
+
test_files: []
|