noreprand 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.
- checksums.yaml +4 -4
- data/lib/noreprand.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 527457765885148cbb46458c4ad9a8c7ffd6046f
|
|
4
|
+
data.tar.gz: 0ed0c080a8ba9796c6ddc721ccf6d14a6790c034
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 370d703a48410f8f45782ba2d2549b8dce817b1361943aa6951952fdebf4187f20fe090b68e7225dab2a65317cfa5581cb9242c7d5242141288b3f735ca9ae9f
|
|
7
|
+
data.tar.gz: c722df87db768dee19003056ced7b0c3de297bcbaece43e0bb726cdabc63ac22e5b659e80e996c89bd20ff7593259bea1eebabd185bb458a1b303dc44ca11bab
|
data/lib/noreprand.rb
CHANGED
|
@@ -4,10 +4,18 @@ class ExceededDigitLimit < StandardError
|
|
|
4
4
|
end
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
class BelowDigitMinimum < StandardError
|
|
8
|
+
def initialize(msg = "Needs to have at least 1 digit")
|
|
9
|
+
super
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
7
13
|
class NoRepRand
|
|
8
14
|
def raand(digitcount, nostartwithzero = false)
|
|
9
15
|
if digitcount > 10
|
|
10
16
|
raise ExceededDigitLimit
|
|
17
|
+
elsif digitcount <= 0
|
|
18
|
+
raise BelowDigitMinimum
|
|
11
19
|
else
|
|
12
20
|
digits = Array(0..9)
|
|
13
21
|
tempnum = []
|