thermostat_robin_spruytte 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/thermostat.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa870098c27235830f1cd4f93605d35f4f2509433be676415d4d6a42239f84f
|
4
|
+
data.tar.gz: 86a4bddc6b031cff43a8b1823fd7bce92554f2d044912e9f7b3ce7e0f508575c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b1f7e36bf662a90ee7e73b55cea0eaf855c50ed45a0da9f25d29b5f2eecb073452c052a876fd2c972a955d6eb113f2c26fe4f0a4a9f1e267d831c0e73e7d31a
|
7
|
+
data.tar.gz: 35efac5ae3739b48d7fc3bfef0900c0fb7fc2105f2135c8997da24eaeda18973f94e7c276a6ef5c4b4f1936fa38c564efc0cc04282513657d71d4d7e8a603c44
|
data/lib/thermostat.rb
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
+
# Simulates a simple thermostat
|
1
2
|
class Thermostat
|
2
3
|
attr_accessor :temperature
|
4
|
+
|
5
|
+
# Initialises the Thermostat class
|
6
|
+
# @param temperature [temperature] the starting thermostat temperature
|
3
7
|
def initialize(**args)
|
4
8
|
@temperature = args[:temperature] || 0
|
5
9
|
end
|
6
10
|
|
11
|
+
# Heats up the thermostat
|
12
|
+
# @param value [value] the increase in temperature
|
7
13
|
def heating(args)
|
8
14
|
self.temperature += args[:value]
|
9
15
|
end
|
10
16
|
|
17
|
+
# Cools down the thermostat
|
18
|
+
# @param value [value] the decrease in temperature
|
11
19
|
def cooling(args)
|
12
20
|
self.temperature -= args[:value]
|
13
21
|
end
|