logicgates 0.0.3 → 0.0.4
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/.gitignore +1 -0
- data/lib/logicgates/version.rb +1 -1
- data/lib/logicgates.rb +13 -13
- 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: c42149d3acf1ea91dae5da4310f4ec129f38c05b
|
4
|
+
data.tar.gz: ec8a98da8af2c4abdaf6612a037cee9771d14ff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0aaff8cd9968b547986a71072e02dc944374ec5f747c5ad02d10184194452c590e95f5dc54d7c056c55dcb4216633d2a89f5ed3ae783a553a3526ea91a6ac36
|
7
|
+
data.tar.gz: 24f72ad1d0fde5cae5812f7f7eca695950ebb57f26988bf72402a499e495b2ec166b44e6ea245a09519cdfd714bc9e2048de4db22eec80b73be0d2f3884cf8e0
|
data/.gitignore
CHANGED
data/lib/logicgates/version.rb
CHANGED
data/lib/logicgates.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
module LogicGates
|
2
2
|
|
3
|
-
def
|
3
|
+
def self.and(a, b)
|
4
4
|
a && b
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
7
|
+
def self.or(a, b)
|
8
8
|
a || b
|
9
9
|
end
|
10
10
|
|
11
|
-
def not(a)
|
11
|
+
def self.not(a)
|
12
12
|
!a
|
13
13
|
end
|
14
14
|
|
15
|
-
def xor(a, b)
|
16
|
-
|
15
|
+
def self.xor(a, b)
|
16
|
+
and(or(a, b), not(and(a, b)))
|
17
17
|
end
|
18
18
|
|
19
|
-
def nor(a, b)
|
20
|
-
not(
|
19
|
+
def self.nor(a, b)
|
20
|
+
not(or(a, b))
|
21
21
|
end
|
22
22
|
|
23
|
-
def nand(a, b)
|
24
|
-
not(
|
23
|
+
def self.nand(a, b)
|
24
|
+
not(and(a, b))
|
25
25
|
end
|
26
26
|
|
27
|
-
def xnor(a, b)
|
27
|
+
def self.xnor(a, b)
|
28
28
|
not(xor(a, b))
|
29
29
|
end
|
30
30
|
|
31
|
-
def mux(a, b, s)
|
32
|
-
|
31
|
+
def self.mux(a, b, s)
|
32
|
+
or(and(a, not(s)), and(b, s))
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
end
|