jasper-vercnocke-thermostat-excercise 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/led.rb +9 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a5a2954951f2f54abcbcd93e4b13cc964d5370a
|
4
|
+
data.tar.gz: d134d608602305e2052a2b72c680aa654b21bb6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee87e79ffa4c9bfd7fcbc2b79f423f7bcf5887140b3b22010b2131498a80d504baacc87f865ce28227c29e47d2c9a765cd9bd46c849ebffb9856b3801bc5d2b
|
7
|
+
data.tar.gz: ee5204044974e145c0d846c48ffd0caa057447846af606a4b5a1fc78c5c295cff5800c0b13b901ff6baf8e9af85b34b811c68b1a0318193fa1d384b3e66b62fa
|
data/lib/led.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
# Led type with full RGB hexadecimals output
|
2
|
+
# The Led class accepts any value and transform it to an hexadecimals RGB output.
|
3
|
+
# @author Jasper Vercnocke <jasper.vercnocke@student.vives.be>
|
1
4
|
class Led
|
2
5
|
def initialize
|
3
6
|
@color = "000000"
|
4
7
|
@zero = "00"
|
5
8
|
end
|
6
9
|
|
10
|
+
# @param value [Number] color in decimals
|
11
|
+
# Set color in RGB hexadecimals
|
7
12
|
def set_color(value)
|
8
13
|
if value < 0
|
9
14
|
calc = value.abs.to_s(16).rjust(2,'0')
|
@@ -19,11 +24,13 @@ class Led
|
|
19
24
|
@color = "00FF00"
|
20
25
|
end
|
21
26
|
end
|
22
|
-
|
27
|
+
# Return color in RGB hexadecimals in string format
|
28
|
+
# @return [String] RGB value in hexadecimals
|
23
29
|
def string
|
24
30
|
"The LED is #{@color}"
|
25
31
|
end
|
26
|
-
|
32
|
+
|
33
|
+
# @return [Number] RGB value in hexadecimals
|
27
34
|
def get_color
|
28
35
|
@color
|
29
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasper-vercnocke-thermostat-excercise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasper Vercnocke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Excercise for education: Thermostat with mqtt & https'
|
14
14
|
email: jasper.vercnocke@student.vives.be
|
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
47
|
version: '0'
|
48
48
|
requirements: []
|
49
49
|
rubyforge_project:
|
50
|
-
rubygems_version: 2.
|
50
|
+
rubygems_version: 2.6.12
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: Thermostat
|