bools 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bools.gemspec +1 -1
- data/lib/bools.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b91898adbcedddadfdd84f19791371b5ea4ed860659aecc394e9323f6583ca9a
|
4
|
+
data.tar.gz: 2634c08fa8710dbaf43147e0ea49a7dd39fe9556f3aff10b9d7094ef3ac8c7de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156753ba96c9e35412d42e01a3f1306051320d36608af9bedc03f6410f11ced1cad2695c8c449f22f501a40d18bde44331f827f161e684754867285540a7d6d4
|
7
|
+
data.tar.gz: dfe62429f49e36a07288af113715dfec3220718f7f871c14b3a0fd682dd5a9b8cb690488155bcb21ab2053942d225614c0bad2abad01d01be245b77fd1f33b99
|
data/bools.gemspec
CHANGED
data/lib/bools.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
def bools!
|
2
2
|
vars = method(:test).arity
|
3
|
-
|
3
|
+
cols = vars.times.map {|i| (97 + i).chr}
|
4
|
+
runs = 1 << vars
|
5
|
+
|
4
6
|
puts
|
5
|
-
puts [*
|
6
|
-
puts ['--' *
|
7
|
-
|
7
|
+
puts [*cols, '|', 'result'] * ' '
|
8
|
+
puts ['--' * cols.size, '-' * 6] * '+-'
|
9
|
+
|
10
|
+
runs.times do |i|
|
8
11
|
list = ("%0*b" % [vars, i]).split('')
|
9
12
|
vals = list.map {|item| item == '1'}
|
10
13
|
resu = !!test(*vals) ? '1' : '0'
|