logicgates 0.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 05bb5f0aae2197374fc05236eaa52951398b93b3
4
+ data.tar.gz: c17708bc7351d7f8ca0bfb69237ad3e4b5fc5509
5
+ SHA512:
6
+ metadata.gz: aaa3f24c3dd5a2d492d883bf8d5063fc522a947b79a1b6df34b84b1518bbd9cc90bac882805816b700bb6e94f57c575393e5f07ac6245a5083d70121a274a2f5
7
+ data.tar.gz: 9178913460fe9e9a359c073741435d8be10476ed4faf7ad2ec9d585d8a35b2c55577f7a82fc937ff914d23fc64944b20b5f46acaa72d8a5df09d67616f8ddeca
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .byebug_history
2
+ logicgates.gemspec
3
+ Rakefile
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rspec', "~> 3.1.0"
4
+ gem 'byebug'
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ specs:
3
+ byebug (9.0.6)
4
+ diff-lcs (1.2.5)
5
+ rspec (3.1.0)
6
+ rspec-core (~> 3.1.0)
7
+ rspec-expectations (~> 3.1.0)
8
+ rspec-mocks (~> 3.1.0)
9
+ rspec-core (3.1.7)
10
+ rspec-support (~> 3.1.0)
11
+ rspec-expectations (3.1.2)
12
+ diff-lcs (>= 1.2.0, < 2.0)
13
+ rspec-support (~> 3.1.0)
14
+ rspec-mocks (3.1.3)
15
+ rspec-support (~> 3.1.0)
16
+ rspec-support (3.1.2)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ byebug
23
+ rspec (~> 3.1.0)
24
+
25
+ BUNDLED WITH
26
+ 1.13.6
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ #LogicGates
2
+
3
+ Common logic gates written in Ruby. A proof that all logical operations can be derived from AND, OR and NOT.
4
+
5
+ ```ruby
6
+ def my_and(a, b)
7
+ a && b
8
+ end
9
+
10
+ def my_or(a, b)
11
+ a || b
12
+ end
13
+
14
+ def not(a)
15
+ !a
16
+ end
17
+
18
+ def xor(a, b)
19
+ my_and(my_or(a, b), not(my_and(a, b)))
20
+ end
21
+
22
+ def nor(a, b)
23
+ not(my_or(a, b))
24
+ end
25
+
26
+ def nand(a, b)
27
+ not(my_and(a, b))
28
+ end
29
+
30
+ def xnor(a, b)
31
+ not(xor(a, b))
32
+ end
33
+
34
+ def mux(a, b, s)
35
+ my_or(my_and(a, not(s)), my_and(b, s))
36
+ end
37
+
38
+ ```
@@ -0,0 +1,35 @@
1
+ module LogicGates
2
+
3
+ def my_and(a, b)
4
+ a && b
5
+ end
6
+
7
+ def my_or(a, b)
8
+ a || b
9
+ end
10
+
11
+ def not(a)
12
+ !a
13
+ end
14
+
15
+ def xor(a, b)
16
+ my_and(my_or(a, b), not(my_and(a, b)))
17
+ end
18
+
19
+ def nor(a, b)
20
+ not(my_or(a, b))
21
+ end
22
+
23
+ def nand(a, b)
24
+ not(my_and(a, b))
25
+ end
26
+
27
+ def xnor(a, b)
28
+ not(xor(a, b))
29
+ end
30
+
31
+ def mux(a, b, s)
32
+ my_or(my_and(a, not(s)), my_and(b, s))
33
+ end
34
+
35
+ end
@@ -0,0 +1,3 @@
1
+ module LogicGates
2
+ VERSION = "0.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logicgates
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - DouglasTGordon
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Common logic gates written in Ruby. A proof that all logical operations
42
+ can be derived from AND, OR and NOT.
43
+ email:
44
+ - douglastgordon@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - README.md
53
+ - lib/logic_gates.rb
54
+ - lib/logicgates/version.rb
55
+ homepage: https://github.com/douglastgordon/LogicGates
56
+ licenses: []
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.5.1
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: All common logic gates
78
+ test_files: []