electric 0.0.4 → 0.0.5
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/README.md +22 -2
- data/lib/electric/ohm.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35f89c80c18ec3cc1bb84c36880b42c2ab55c0a0
|
4
|
+
data.tar.gz: 050c9b402d0b7a7448664818684edd1c5b7446b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faf6ba1905bf0c341b0962c814bc3b396874c4e84a3b99678738481b014da3fdfff690d69a062ef3aafdaf759d515fdf9073f76e24bcf66b0208b7423caf87f6
|
7
|
+
data.tar.gz: d10ed648975f54ab0b746a8b1334f40c4ddc84652750cca713d011ce99afc1c34173f8663966a1ab8726b2e8a62b112e143ac78b9eae374768023444119c8ae8
|
data/README.md
CHANGED
@@ -1,11 +1,31 @@
|
|
1
1
|
## Ruby Library for electronics
|
2
2
|
|
3
3
|
### Resistor Color Code Calculator
|
4
|
-
|
4
|
+
|
5
|
+
Accepts 4 arguments (first 3 bands determine resistor value, 4th band is for tolerance %), though none are required to return a value of 0 ohms. You must preserve order of bands as arguments.
|
6
|
+
|
7
|
+
resistor = Electric::Resistor.new("red", "black", "brown")
|
8
|
+
resistor.value
|
9
|
+
=> 200
|
10
|
+
resistor.tolerance
|
11
|
+
=> "5%"
|
12
|
+
resistor.human_readable
|
13
|
+
=> "200 ohms, +/- 5%"
|
5
14
|
|
6
15
|
### Ohm's Law Calculator
|
7
|
-
Electric::Ohm.new(:volts => 5, :ohms => 330).current
|
8
16
|
|
17
|
+
Accepts 4 named arguments: "volts", "ohms", "amps", and "watts" in any order. You must provide at least 2 properties to calculate other 2.
|
18
|
+
|
19
|
+
There are 4 methods that can be called to run calculations: "resistance", "power", "voltage", and "current"
|
20
|
+
|
21
|
+
Electric::Ohm.new(:volts => 5, :ohms => 330).voltage
|
22
|
+
=> 5.0
|
23
|
+
Electric::Ohm.new(:volts => 5, :ohms => 330).resistance
|
24
|
+
=> 330.0
|
25
|
+
Electric::Ohm.new(:volts => 5, :ohms => 330).current
|
26
|
+
=> 0.015151515151515152
|
27
|
+
Electric::Ohm.new(:volts => 5, :ohms => 330).power
|
28
|
+
=> 0.07575757575757576
|
9
29
|
|
10
30
|
|
11
31
|
More documentation on the way...
|
data/lib/electric/ohm.rb
CHANGED