binary 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -5
  3. data/lib/binary/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec27b3cd7dfa1d2bfcf834091ba8ccdc1122242f0599460903079baee8f40a36
4
- data.tar.gz: 769b49ac606231ff06b07eb8e1e614d8188acdea81e0ffa0c08d80dce5492e14
3
+ metadata.gz: 75468b4cae9ef1a47cc46ca0eb99c9fb85add39974ef077578dd40b413afa80d
4
+ data.tar.gz: d1aea9ccf064910c3ebf4e8176ae199d2aa3df781c562e572de15034859cc7b8
5
5
  SHA512:
6
- metadata.gz: 4bda31ed4f9c3e5f737bc44d4ae688c92fec03020c7bd03e08cff05bfca8401c9419ffe13ad4f3294178f4b6f95bf533fef882e3353bc54e66cef0975bccc105
7
- data.tar.gz: 2775541257d014f3b0347dc14f9d093e1065679ad40661daa4aa923229124dedb7a3b40d74c7b505dd3176a6d70dd274d8525ecce35ae6df78f40da0d23cc0c1
6
+ metadata.gz: d9df1158b6adc4b43fbde0705077cfa02813c4d7c844b4357e6ef641d114ae41a23d48319c4fe300c49ba154f9059f3f1448a46ada83b52dea34f52e43d1c0dc
7
+ data.tar.gz: 4091347bfafee9191823590b5a5ce9f2697c2217d1ea46039d7e7f97b84dc45c505d2342688f4e68a743bbd20fb66721dfc248221e5481b078897c31a0a59db9
data/README.md CHANGED
@@ -28,19 +28,41 @@ require 'binary'
28
28
  Then to get the binary representation of a number, you just need to call `Binary.binary` and pass the number to it, something like follows:
29
29
 
30
30
  ```ruby
31
- Binary.binary(2018)
31
+ Binary.binary 2018
32
32
  ```
33
- Output: `"11111100010"`.
33
+ `Output: "11111100010"`.
34
34
 
35
35
  Also you can pass an array of integers to the method to get an array of their binary values.
36
36
  ```ruby
37
37
  Binary.binary([26,6,1991])
38
38
  ```
39
- Output: `["11010", "110", "11111000111"]`.
39
+ `Output: ["11010", "110", "11111000111"]`.
40
40
 
41
- ## Development
41
+ Other methods you can use:
42
42
 
43
- ...
43
+ ```ruby
44
+ # number of bits in a number's binary
45
+ Binary.bits 1000
46
+ ```
47
+ `Output: 10`.
48
+
49
+ ```ruby
50
+ # number of ones in a number's binary
51
+ Binary.ones 1000
52
+ ```
53
+ `Output: 6`.
54
+
55
+ ```ruby
56
+ # number of zeros in a number's binary
57
+ Binary.zeros 1000
58
+ ```
59
+ `Output: 4`.
60
+
61
+ ```ruby
62
+ # get array of binaries of all prime numbers between 2 and the given number
63
+ Binary.prime 25
64
+ ```
65
+ `Output: ["10", "11", "101", "111", "1011", "1101", "10001", "10011", "10111"]`.
44
66
 
45
67
  ## Contributing
46
68
 
@@ -1,3 +1,3 @@
1
1
  module Binary
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mo Almishkawi