shenanigans 1.0.15 → 1.0.16

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: 6b59ed384b8df1b8998e226ae092c61983fcbb926f52d825f77ca4cc6ffd455f
4
- data.tar.gz: 36030c324aadae0a3f8ac00a5d2b0283dff3fa9e65ab682a7e3d6073da2472a6
3
+ metadata.gz: 6e7e996c24ffbe66519073bafd5f160aba38a5de770493d2b6ef013c68398aae
4
+ data.tar.gz: f4785e43a5297504fe49818b80d7f5e57d6f32040c01f89548e1c303f3527556
5
5
  SHA512:
6
- metadata.gz: 5ace930024d466feb40bdb52dde54effb61182f3c2dcf13d4a8f34ed9cfcae8aec8509fdb04fee40317a1072640682af1e26b82a1759e1066b6cf2a91d58ebd3
7
- data.tar.gz: d04dcb70b2565d320cf971864199e8f038c3fe0e609fb507adcab68000d271bad646e6f78f42b41095101930f5c9bf3ad402c2fac9a0c84411e5088c5eefa133
6
+ metadata.gz: f7e8cb5e2a908f55f863e0859d5ff1ac58bef88ecab500d3f370c2162a25c0ce879e0e2db120cecec7c7ad9a5293ecebd430259afc11f6f50c22c8955609e8b7
7
+ data.tar.gz: dbbd0e0967510ce79c8ab5b47dcf791b31e6b9912b6e25deaba260c9b9c1e9cff2932e41ae4deb9eb04a3cc9e0c929b133221921141013050a871add2eee5264
metadata CHANGED
@@ -1,22 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shenanigans
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kohl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: standard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.20
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.20
13
83
  description: A collection of extensions for various Ruby core classes.
14
- email: citizen428@gmail.com
84
+ email: me@citizen428.net
15
85
  executables: []
16
86
  extensions: []
17
87
  extra_rdoc_files: []
18
88
  files:
19
- - Gemfile
20
89
  - LICENSE
21
90
  - README.rdoc
22
91
  - lib/shenanigans.rb
@@ -44,23 +113,6 @@ files:
44
113
  - lib/shenanigans/string.rb
45
114
  - lib/shenanigans/string/cmpi.rb
46
115
  - lib/shenanigans/string/in_groups_of.rb
47
- - test/array/caret_test.rb
48
- - test/array/random_subarray_test.rb
49
- - test/array/reductions_test.rb
50
- - test/array/zip_with_test.rb
51
- - test/hash/extract_test.rb
52
- - test/hash/has_shape_pred_test.rb
53
- - test/hash/to_ostruct_test.rb
54
- - test/integer/divisible_by_test.rb
55
- - test/integer/string_length_test.rb
56
- - test/kernel/fn_test.rb
57
- - test/kernel/prompt_test.rb
58
- - test/kernel/require_optional_test.rb
59
- - test/kernel/with_test.rb
60
- - test/module/private_accessor_test.rb
61
- - test/object/display_test.rb
62
- - test/string/cmpi_test.rb
63
- - test/string/in_groups_of_test.rb
64
116
  homepage: http://rubydoc.info/gems/shenanigans/frames
65
117
  licenses:
66
118
  - MIT
@@ -80,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
132
  - !ruby/object:Gem::Version
81
133
  version: '0'
82
134
  requirements: []
83
- rubygems_version: 3.2.22
135
+ rubygems_version: 3.3.7
84
136
  signing_key:
85
137
  specification_version: 4
86
138
  summary: Think Facets, just less useful
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rake"
4
-
5
- group :developement do
6
- gem "minitest", ">= 2.6.0"
7
- gem "standard"
8
- gem "yard"
9
- end
@@ -1,9 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/array/caret"
3
-
4
- class ArrayCaret < Minitest::Test
5
- def test_caret
6
- result = [1, 2, 3] ^ [1, 2, 4]
7
- assert result == [3, 4]
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/array/random_subarray"
3
-
4
- class RandomSubarray < Minitest::Test
5
- def test_random_subarray
6
- result = [*1..5].random_subarray(3)
7
- assert result.size == 3
8
- assert result.map { |a| a.all? { |x| x < 5 } }
9
- end
10
- end
@@ -1,27 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/array/reductions"
3
-
4
- class ArrayReductions < Minitest::Test
5
- TEST_ARRAY = [*1..4]
6
-
7
- def test_reductions_without_params_or_block
8
- assert_raises(ArgumentError) { TEST_ARRAY.reductions }
9
- end
10
-
11
- def test_reductions_operator_only
12
- assert TEST_ARRAY.reductions(:+) == [1, 3, 6, 10]
13
- end
14
-
15
- def test_reductions_initial_only
16
- assert TEST_ARRAY.reductions(50) { |acc, b| acc + b } == [50, 51, 53, 56, 60]
17
- end
18
-
19
- def test_reductions_inital_and_operator
20
- assert TEST_ARRAY.reductions(50, :+) == [50, 51, 53, 56, 60]
21
- end
22
-
23
- def test_reductions_without_params
24
- assert TEST_ARRAY.reductions { |acc, b| acc + b } == [1, 3, 6, 10]
25
- assert %w[a b c].reductions { |s1, s2| s1 + s2 } == %w[a ab abc]
26
- end
27
- end
@@ -1,14 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/array/zip_with"
3
-
4
- class ZipWith < Minitest::Test
5
- def test_zip_with_with_symbol
6
- result = [*1..3].zip_with([*1..3], :+)
7
- assert result == [2, 4, 6]
8
- end
9
-
10
- def test_zip_with_with_block
11
- result = [*"a".."c"].zip_with([*"a".."c"]) { |a, b| a * 2 + b.upcase }
12
- assert result == %w[aaA bbB ccC]
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/hash/extract"
3
-
4
- class Extract < Minitest::Test
5
- def test_extract
6
- hash = { a: 1, b: 2, c: 3 }
7
- assert_equal hash.extract(:b, :a), { a: 1, b: 2 }
8
- assert_equal hash.extract(:a, :d), { a: 1 }
9
- assert_equal({}.extract(:a, :c), {})
10
- end
11
- end
@@ -1,40 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/hash/has_shape_pred"
3
-
4
- class HasShape < Minitest::Test
5
- def setup
6
- @hash = {
7
- k1: 1.0,
8
- k2: 1,
9
- k3: {
10
- k4: "1",
11
- k5: {
12
- k6: Array
13
- }
14
- }
15
- }
16
- end
17
-
18
- def test_has_shape
19
- shape_pass = {
20
- k1: Float,
21
- k2: Integer,
22
- k3: {
23
- k4: String,
24
- k5: {
25
- k6: Class
26
- }
27
- }
28
- }
29
-
30
- assert @hash.has_shape?(shape_pass)
31
- end
32
-
33
- def test_has_shape_fail
34
- shape_fail = {
35
- k1: Float
36
- }
37
-
38
- assert !@hash.has_shape?(shape_fail)
39
- end
40
- end
@@ -1,23 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/hash/to_ostruct"
3
-
4
- class ToOstruct < Minitest::Test
5
- def test_simple_hash
6
- struct = {a: 1, b: 2}.to_ostruct
7
- assert struct.a == 1
8
- assert struct.b == 2
9
- end
10
-
11
- def test_nested_hash
12
- struct = {a: 1, b: {c: 3}}.to_ostruct
13
- assert struct.a == 1
14
- assert struct.b.c == 3
15
- end
16
-
17
- def test_nested_array
18
- struct = {a: 1, b: [{c: 2}, 5]}.to_ostruct
19
- assert struct.a == 1
20
- assert struct.b.first.c == 2
21
- assert struct.b.last == 5
22
- end
23
- end
@@ -1,16 +0,0 @@
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
@@ -1,16 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/integer/string_length"
3
-
4
- class StringLength < Minitest::Test
5
- def test_zero
6
- assert 0.string_length == 1
7
- end
8
-
9
- def test_positive
10
- assert 123.string_length == 3
11
- end
12
-
13
- def test_negative
14
- assert(-1.string_length) == 2
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/kernel/fn"
3
-
4
- class Fn < Minitest::Test
5
- def test_with_symbols
6
- result = ["foo bar", "baz qux"].map(&fn(:split, :last))
7
- assert result == ["bar", "qux"]
8
- end
9
-
10
- def test_with_symbols_and_lambdas
11
- result = (1..3).map(&fn(:next, ->(x) { x * x }, ->(x) { x.to_f / 2 }))
12
- assert result == [2.0, 4.5, 8.0]
13
- end
14
- end
@@ -1,27 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/kernel/prompt"
3
- require "stringio"
4
-
5
- class Prompt < Minitest::Test
6
- def setup
7
- @orig_stdin = $stderr
8
- @orig_stdout = $stdout
9
- $stdin = StringIO.new("42\n")
10
- $stdout = StringIO.new
11
- end
12
-
13
- def teardown
14
- $stdin = @orig_stdin
15
- $stdout = @orig_stdout
16
- end
17
-
18
- def test_prompt
19
- result = prompt("Foo> ")
20
- assert result == "42"
21
- end
22
-
23
- def test_prompt_with_conversion
24
- result = prompt("Foo> ", :to_f)
25
- assert result == 42.0
26
- end
27
- end
@@ -1,15 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/kernel/require_optional"
3
- require "stringio"
4
-
5
- class RequireOptional < Minitest::Test
6
- def test_require_optional
7
- assert_nil require_optional("non_existent")
8
- end
9
-
10
- def test_require_optional_with_block
11
- res = require_optional("non_existent") { 42 }
12
-
13
- assert_equal res, 42
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/kernel/with"
3
-
4
- class With < Minitest::Test
5
- def test_with
6
- result = with([]) { |a|
7
- a << "a"
8
- a << "b"
9
- }
10
- assert result == %w[a b]
11
- end
12
- end
@@ -1,21 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/module/private_accessor"
3
-
4
- class PrivateAccessor < Minitest::Test
5
- class Foo
6
- private_accessor :bar, :baz
7
-
8
- def initialize(v1, v2)
9
- self.bar = v1
10
- self.baz = v2
11
- end
12
- end
13
-
14
- def test_private_accessor
15
- f = Foo.new(1, 2)
16
- assert f.instance_variables == [:@bar, :@baz]
17
- assert (f.private_methods & [:bar, :baz, :bar=, :baz=]).size == 4
18
- assert f.instance_variable_get("@bar") == 1
19
- assert f.instance_variable_get("@baz") == 2
20
- end
21
- end
@@ -1,35 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/object/display"
3
- require "stringio"
4
-
5
- class Display < Minitest::Test
6
- def setup
7
- @orig_stdout = $stdout
8
- $stdout = StringIO.new("", "r+")
9
- end
10
-
11
- def teardown
12
- $stdout = @orig_stdout
13
- end
14
-
15
- def test_display
16
- str = "foo"
17
- assert str.display == str
18
- $stdout.rewind
19
- assert $stdout.gets.chomp == str
20
- end
21
-
22
- def test_display_alias
23
- str = "foo"
24
- assert str.d == str
25
- $stdout.rewind
26
- assert $stdout.gets.chomp == str
27
- end
28
-
29
- def test_display_no_new_line
30
- str = "foo"
31
- assert str.display(false) == str
32
- $stdout.rewind
33
- assert $stdout.gets == str
34
- end
35
- end
@@ -1,10 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/string/cmpi"
3
-
4
- class Cmpi < Minitest::Test
5
- def cmpi
6
- str = "aabbcc"
7
- assert str.cmpi("AAbbcc")
8
- assert_equal cmpi("foo"), false
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- require "minitest/autorun"
2
- require "shenanigans/string/in_groups_of"
3
-
4
- class InGroupsOf < Minitest::Test
5
- def test_in_groups_of
6
- str = "aabbcc"
7
- assert str.in_groups_of(2) == ["aa", "bb", "cc"]
8
- assert "".in_groups_of(2) == []
9
- assert_raises(ArgumentError) { "".in_groups_of(0) }
10
- end
11
- end