circuits 0.11.2 → 0.11.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTYwYmM0YTZmMjVmMzQxZWU5M2Y0ZTUxNjAwNWVlM2U4NDVjOTA0YQ==
4
+ YTUwYzEzOTc5ZGVmNzIyZTg2ZjNjZmEwN2RjMTNjMzk1ZWIxOTRiOQ==
5
5
  data.tar.gz: !binary |-
6
- OGQ3ZTMzMjA4ODdiMTZiOGY1YzQ4YTE5ZjUyMWY5MTZlODhiOGI5Nw==
6
+ YmM1YTFiM2U2OTRhY2MzNTMwM2RjMTM3NWVjYmVmOWQ4NWMyN2ZmMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTliMmUwNWJlZjg0MGZjYjFkZDlkMzdjODgwOWRjMmUxZWU5NDBmYjU4MWNi
10
- ZjJmOWUwMWViZDVmZmY0ODhmZjg5ODVkMDE1MTcyMzM1NzY4N2FjNzRhNWU0
11
- Nzg0YWNjOTI3ZWRjMGI1MTg0NTY1MTMwZWE2YTE2NDdjNzM3YjA=
9
+ NTJiMzMzODdhMDZkNzAxZDU0ZmIzN2I1ZjI2OTA0ODQwZmE1YWU0ZDY3Zjc2
10
+ MTE5MjI5NGMzYTFmZmVjZjRlNWJiNzBlZmNiOTVhNzNhNWE1MmVjODcyOTcz
11
+ ZTc5NmZjZmJlYWRiMGJmMDQzNTBkODI5ZjZkMjVhMjIyY2EwYmU=
12
12
  data.tar.gz: !binary |-
13
- Y2I5ZWNiM2EwMWQ1YWQxNGRhOWI4ZTQ4YjMyMjE1MTQwNjRkYzAxNDg1YWJl
14
- ZWViZTc0OTBiNmU0ZGYwMmRkZjk1YjU3MDEyMTA5MTc4M2RmN2QzYTIxNmFh
15
- MjljODNkZjAzZTJiMWNmZDJjM2I2NDU5NzY3NGQ2MWI5YzkxMWE=
13
+ OGUyYTFjZTUwMjNkNTNhZjAyMzI3MzI4OTAzMmRmM2NiNmQ2ZThmODMzMTE4
14
+ YWQ3Y2U3NTk3MDc0N2EyOGNmZTE4YmU4MWZiNmJjYmEzMDgwYmFkMjM3ODhh
15
+ NDc0MDRmZDYyZTBkYjI4MDFmZWI0OWEyZTJiNGRmOGJiNzI4ZGI=
@@ -1,7 +1,6 @@
1
1
  require 'circuits/component/base'
2
- require 'circuits/component/and'
2
+ require 'circuits/component/half_adder'
3
3
  require 'circuits/component/or'
4
- require 'circuits/component/xor'
5
4
 
6
5
  module Circuits
7
6
  module Component
@@ -20,50 +19,36 @@ module Circuits
20
19
 
21
20
  def create_sub_components
22
21
  {
23
- and_in: And.new,
24
- and_carry: And.new,
22
+ half_adder_in: HalfAdder.new,
23
+ half_adder_carry: HalfAdder.new,
25
24
  or_gate: Or.new,
26
- xor_in: Xor.new,
27
- xor_out: Xor.new
28
25
  }
29
26
  end
30
27
 
31
28
  def link(sub_components)
32
- link_and_in sub_components
33
- link_and_carry sub_components
29
+ link_half_adder_in sub_components
30
+ link_half_adder_carry sub_components
34
31
  link_or_gate sub_components
35
- link_xor_in sub_components
36
- link_xor_out sub_components
37
32
  link_outputs sub_components
38
33
  end
39
34
 
40
- def link_and_in(sub_components)
41
- sub_components[:and_in].a.set a
42
- sub_components[:and_in].b.set b
35
+ def link_half_adder_in(sub_components)
36
+ sub_components[:half_adder_in].a.set a
37
+ sub_components[:half_adder_in].b.set b
43
38
  end
44
39
 
45
- def link_and_carry(sub_components)
46
- sub_components[:and_carry].a.set sub_components[:xor_in].out
47
- sub_components[:and_carry].b.set c_in
40
+ def link_half_adder_carry(sub_components)
41
+ sub_components[:half_adder_carry].a.set sub_components[:half_adder_in].s
42
+ sub_components[:half_adder_carry].b.set c_in
48
43
  end
49
44
 
50
45
  def link_or_gate(sub_components)
51
- sub_components[:or_gate].a.set sub_components[:and_in].out
52
- sub_components[:or_gate].b.set sub_components[:and_carry].out
53
- end
54
-
55
- def link_xor_in(sub_components)
56
- sub_components[:xor_in].a.set a
57
- sub_components[:xor_in].b.set b
58
- end
59
-
60
- def link_xor_out(sub_components)
61
- sub_components[:xor_out].a.set sub_components[:xor_in].out
62
- sub_components[:xor_out].b.set c_in
46
+ sub_components[:or_gate].a.set sub_components[:half_adder_carry].c
47
+ sub_components[:or_gate].b.set sub_components[:half_adder_in].c
63
48
  end
64
49
 
65
50
  def link_outputs(sub_components)
66
- s.set sub_components[:xor_out].out
51
+ s.set sub_components[:half_adder_carry].s
67
52
  c_out.set sub_components[:or_gate].out
68
53
  end
69
54
  end
@@ -1,5 +1,5 @@
1
1
  # Circuits allows you to express logical circuits in code
2
2
  module Circuits
3
3
  # The version of the Circuits gem
4
- VERSION = '0.11.2'
4
+ VERSION = '0.11.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Muru Paenga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-01 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler