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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b2455418fc4671757f0ed454480bab16c0932e3ec8bf7f2c63f6f565319d64c
4
- data.tar.gz: 9b359a6bb6504d3664591bb396845caaba048323e7c7cb46b16ceacd34611929
3
+ metadata.gz: 6b59ed384b8df1b8998e226ae092c61983fcbb926f52d825f77ca4cc6ffd455f
4
+ data.tar.gz: 36030c324aadae0a3f8ac00a5d2b0283dff3fa9e65ab682a7e3d6073da2472a6
5
5
  SHA512:
6
- metadata.gz: 6ada5cb0858a97e82f34bb5523822868e1c9c2133d8542bced908a467c0de00e902c3fff86004449bfcc9e52bc92bf25c500f583a15dd80da85436f0a6a923a8
7
- data.tar.gz: 4fabbfc917479bf8794233a80005c51a0b37057e329122109190de4ee18a18c4f869e1fd0c4aa9c07e9ee2223b9aa59bade9b16e24f01c357e8f5cefe2dbc827
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: Fixnum, k2: String) #=> true
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
+
@@ -1 +1,2 @@
1
+ require_relative "integer/divisible_by"
1
2
  require_relative "integer/string_length"
data/lib/shenanigans.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "shenanigans/array"
2
- require "shenanigans/fixnum"
3
2
  require "shenanigans/hash"
3
+ require "shenanigans/integer"
4
4
  require "shenanigans/kernel"
5
5
  require "shenanigans/module"
6
6
  require "shenanigans/object"
@@ -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.14
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: 2020-05-05 00:00:00.000000000 Z
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.1.2
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: []