binary 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5413bfbbb06f145c508b6c61e026bf7118ba9e24cd89dadf095f5295b96814f5
4
- data.tar.gz: 4a9e45627fe3817d9c8fe41f43cf3c4896ee420cff3bf920355aba045109da8d
3
+ metadata.gz: a7aea0a9e122f5815c78ee5d186eacc19162a08b6bcfd4e31aabe724fb646903
4
+ data.tar.gz: 4c9adaa9ee31905ebe31b39f6f08c3b6000698c2c9f379436fc56fcd6c015329
5
5
  SHA512:
6
- metadata.gz: fa99b9143ef903338e9cc5c8e4af220b406283eb42376f336b2bff8a71721323ce9dd98f4b05040cf079eb4df6747728ccbae6f6d9be77113bd72bdfc4a1410d
7
- data.tar.gz: 7c6bff1b952513a69d130dc5345d31c372af3b8f12b825cfbcdf9d35ca9d5cb6ea5156a1f3b16d5d5eccb6e0127dc4e807331a9ac9a88731354fc9b11000f2c1
6
+ metadata.gz: be22f4282c26d008503775d1e9ea815ca48be732007fe804f7510262258271e2464274049a2f365029146cb289ab0320d7bb58e67d4a09b275c08ef5f64fb847
7
+ data.tar.gz: dd40123cc95e3a82d887549cf970f64018a115116dbef8705ed934fb4f471146f3ebe7efbaee8c5eee343a93be4e0c1b9ce8493987b3f0902b0c622e0056f627
data/README.md CHANGED
@@ -32,6 +32,12 @@ Binary.binary(2018)
32
32
  ```
33
33
  Output: `"11111100010"`.
34
34
 
35
+ Also you can pass an array of integers to the method to get an array of their binary values.
36
+ ```ruby
37
+ Binary.binary([26,6,1991])
38
+ ```
39
+ Output: `["11010", "110", "11111000111"]`.
40
+
35
41
  ## Development
36
42
 
37
43
  ...
@@ -1,9 +1,11 @@
1
1
  require "binary/version"
2
2
 
3
3
  module Binary
4
- def self.binary(number=nil)
5
- if number.class == Integer
6
- number.to_s(2)
4
+ def self.binary(input=nil)
5
+ if input.class == Array
6
+ input.map { |num| num.to_s(2) }
7
+ elsif input.class == Integer
8
+ input.to_s(2)
7
9
  end
8
10
  end
9
11
  end
@@ -1,3 +1,3 @@
1
1
  module Binary
2
- VERSION = "0.0.1"
2
+ VERSION = "0.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: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mo Almishkawi