shenanigans 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shenanigans/hash/has_shape_pred.rb +1 -1
- data/lib/shenanigans/integer/divisible_by.rb +13 -0
- data/lib/shenanigans/integer.rb +1 -0
- data/lib/shenanigans.rb +1 -1
- data/test/integer/divisible_by_test.rb +16 -0
- metadata +8 -27
- data/doc/Array.html +0 -549
- data/doc/Hash.html +0 -438
- data/doc/Integer.html +0 -219
- data/doc/Kernel.html +0 -500
- data/doc/Module.html +0 -233
- data/doc/Object.html +0 -215
- data/doc/String.html +0 -300
- data/doc/_index.html +0 -185
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -496
- data/doc/file.README.html +0 -131
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -131
- data/doc/js/app.js +0 -314
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -179
- data/doc/top-level-namespace.html +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b59ed384b8df1b8998e226ae092c61983fcbb926f52d825f77ca4cc6ffd455f
|
4
|
+
data.tar.gz: 36030c324aadae0a3f8ac00a5d2b0283dff3fa9e65ab682a7e3d6073da2472a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ace930024d466feb40bdb52dde54effb61182f3c2dcf13d4a8f34ed9cfcae8aec8509fdb04fee40317a1072640682af1e26b82a1759e1066b6cf2a91d58ebd3
|
7
|
+
data.tar.gz: d04dcb70b2565d320cf971864199e8f038c3fe0e609fb507adcab68000d271bad646e6f78f42b41095101930f5c9bf3ad402c2fac9a0c84411e5088c5eefa133
|
@@ -3,7 +3,7 @@ class Hash
|
|
3
3
|
#
|
4
4
|
# @example Simple hash
|
5
5
|
# h = { k1: 1, k2: "1" }
|
6
|
-
# h.has_shape?(k1:
|
6
|
+
# h.has_shape?(k1: Integer, k2: String) #=> true
|
7
7
|
# h.has_shape?(k1: Class, k2: String) #=> false
|
8
8
|
# @example Nested hashes
|
9
9
|
# h = { k1: [], k2: { k3: Struct.new("Foo") } }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Integer
|
2
|
+
# Checks whether the receiver is cleanly divisble by the argument.
|
3
|
+
# @example
|
4
|
+
# 3.divisble_by(0) #=> false
|
5
|
+
# 3.divisble_by(2) #=> false
|
6
|
+
# 9.divisble_bu(3) #=> true
|
7
|
+
def divisible_by(n)
|
8
|
+
return false if n.zero?
|
9
|
+
|
10
|
+
self % n == 0
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
data/lib/shenanigans/integer.rb
CHANGED
data/lib/shenanigans.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "shenanigans/integer/divisible_by"
|
3
|
+
|
4
|
+
class StringLength < Minitest::Test
|
5
|
+
def test_divide_by_zero
|
6
|
+
refute 3.divisible_by(0)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_not_divisible
|
10
|
+
refute 3.divisible_by(2)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_divisible
|
14
|
+
assert 9.divisible_by(3)
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shenanigans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kohl
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A collection of extensions for various Ruby core classes.
|
14
14
|
email: citizen428@gmail.com
|
@@ -19,27 +19,6 @@ files:
|
|
19
19
|
- Gemfile
|
20
20
|
- LICENSE
|
21
21
|
- README.rdoc
|
22
|
-
- doc/Array.html
|
23
|
-
- doc/Hash.html
|
24
|
-
- doc/Integer.html
|
25
|
-
- doc/Kernel.html
|
26
|
-
- doc/Module.html
|
27
|
-
- doc/Object.html
|
28
|
-
- doc/String.html
|
29
|
-
- doc/_index.html
|
30
|
-
- doc/class_list.html
|
31
|
-
- doc/css/common.css
|
32
|
-
- doc/css/full_list.css
|
33
|
-
- doc/css/style.css
|
34
|
-
- doc/file.README.html
|
35
|
-
- doc/file_list.html
|
36
|
-
- doc/frames.html
|
37
|
-
- doc/index.html
|
38
|
-
- doc/js/app.js
|
39
|
-
- doc/js/full_list.js
|
40
|
-
- doc/js/jquery.js
|
41
|
-
- doc/method_list.html
|
42
|
-
- doc/top-level-namespace.html
|
43
22
|
- lib/shenanigans.rb
|
44
23
|
- lib/shenanigans/array.rb
|
45
24
|
- lib/shenanigans/array/caret.rb
|
@@ -51,6 +30,7 @@ files:
|
|
51
30
|
- lib/shenanigans/hash/has_shape_pred.rb
|
52
31
|
- lib/shenanigans/hash/to_ostruct.rb
|
53
32
|
- lib/shenanigans/integer.rb
|
33
|
+
- lib/shenanigans/integer/divisible_by.rb
|
54
34
|
- lib/shenanigans/integer/string_length.rb
|
55
35
|
- lib/shenanigans/kernel.rb
|
56
36
|
- lib/shenanigans/kernel/fn.rb
|
@@ -71,6 +51,7 @@ files:
|
|
71
51
|
- test/hash/extract_test.rb
|
72
52
|
- test/hash/has_shape_pred_test.rb
|
73
53
|
- test/hash/to_ostruct_test.rb
|
54
|
+
- test/integer/divisible_by_test.rb
|
74
55
|
- test/integer/string_length_test.rb
|
75
56
|
- test/kernel/fn_test.rb
|
76
57
|
- test/kernel/prompt_test.rb
|
@@ -84,7 +65,7 @@ homepage: http://rubydoc.info/gems/shenanigans/frames
|
|
84
65
|
licenses:
|
85
66
|
- MIT
|
86
67
|
metadata: {}
|
87
|
-
post_install_message:
|
68
|
+
post_install_message:
|
88
69
|
rdoc_options: []
|
89
70
|
require_paths:
|
90
71
|
- lib
|
@@ -99,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
80
|
- !ruby/object:Gem::Version
|
100
81
|
version: '0'
|
101
82
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
83
|
+
rubygems_version: 3.2.22
|
84
|
+
signing_key:
|
104
85
|
specification_version: 4
|
105
86
|
summary: Think Facets, just less useful
|
106
87
|
test_files: []
|