binToDec 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/doc/user-guide.txt +21 -0
  3. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f29ce3797c9016ea5929be748b10abf05fedceec
4
- data.tar.gz: 39c1c194ab47c6b893aaa8e8f6904e7af1e6aca9
3
+ metadata.gz: f89879084bbe2ef36b8289a3fcc31ceee13132f3
4
+ data.tar.gz: df4aaf79855e30e2f7c8f50f701f435893e86db0
5
5
  SHA512:
6
- metadata.gz: b6f9b4760ec0a41c994f47114f270f398f98c80dfeb17f52204ba6a15bb7f5a31f48aada53620421c63896b3e4c8cdcbcdc29bb293b99eb97a186953548dcaf5
7
- data.tar.gz: 79be66dd2362227f630391c2f647b36ae2b0c95a8da277fbbe90fea4316164c1cfdec1ffa7404782cd78fbd99fa3f06a1e43517635f9fe21ba78ba1f562abde5
6
+ metadata.gz: 2c03ce2f8782c54a7a9838c46844f31a715857ac96dd6a532957bff25cd84be41847fcebe95e3c84abd13d6022f63bd03f3f9d4129feea2b067627b07f98ab14
7
+ data.tar.gz: 5a2d2f4ea6e77dc90cc4662f4e1d38d7dabffd6bc5e7cb2a5c3b11ec5b56518963b3967772ae1a902996896416110d37c06fcf4c28e84d7937f3054d546cd1c0
@@ -0,0 +1,21 @@
1
+ binToDec converts a binary number to a decimal only if
2
+ the argument is binary.
3
+
4
+ It should be considered an experimental gem.
5
+
6
+ The main function, binToDec(), ins contained within a Converter module.
7
+
8
+ Usage:
9
+
10
+ Converter.binToDec(1000)
11
+ Converter.bintoDec(2)
12
+
13
+ The program uses the following test to determine if the input is binary:
14
+
15
+ arg1.to_s.split(//).map { |i| i.to_i }.find_all { |value| value > 0 }.inject(:*)
16
+
17
+ The program uses the following code to convert the input (arg1) to binary.
18
+
19
+ result = arg1.to_s.split(//).map { |i| i.to_i }.inject(0) { |accumulator, value| (accumulator + value) * 2 }
20
+
21
+ return result/2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binToDec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomgdow
@@ -10,14 +10,17 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-12-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: An experimental gem
13
+ description: ! "An experimetal gem\n binToDec converts a binary number to a decimal
14
+ only if the supplied number is binary.\n"
14
15
  email: thomasgdowling@gmail.com
15
16
  executables: []
16
17
  extensions: []
17
- extra_rdoc_files: []
18
+ extra_rdoc_files:
19
+ - doc/user-guide.txt
18
20
  files:
19
21
  - Rakefile
20
22
  - lib/binToDec.rb
23
+ - doc/user-guide.txt
21
24
  - test/test_binToDec.rb
22
25
  homepage: http://rubygems.org/gems/binToDec
23
26
  licenses: