array-tweaks 1.0.2 → 1.0.3

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: 1232d121fcc67f7e7882a80a37eea04be80491b52904a501b2fd303243af14f4
4
- data.tar.gz: 1d9e8cbe4c59064dc88eb3e7e2ed3b9f16ed321c803b4fca0d9fa2cfdb9f01f9
3
+ metadata.gz: 67e70998dccd108a9fdee63c1281b5bb531afcc7dc3f069d9f736fc67f214ed7
4
+ data.tar.gz: c8eda580c8b7246b4f228db6c74ab5a626d3e7536836f8f12ea67bec386ea5da
5
5
  SHA512:
6
- metadata.gz: 0f7d22cf7bebf545f786a832f00d078c3a82fe82d1aee1dde3ff81952e7e3831d6e8a0206bd6a6ec48e7aa699ca744bbc80f83c10b39bc781445a0d49666d375
7
- data.tar.gz: 7d0877a98921bc82a360518c8ba8f7a3cc8124df6c7a57dd9976d51ffaf9dc4a9d86e617d1df32a520ddbb7d5b7a28b202cbcf2a569c5e1f91b383d50d1f0cf9
6
+ metadata.gz: e1b3d5b61c85475c616dc774c9b2f840a7673e2222ebb44de1020350c52971f86fe6ed357393f0627df6a114adafc122e6c1edb1b8b2e1da97107c4b380e78d4
7
+ data.tar.gz: 72848c0ebf9c09f5262c258bd58b2dda1248662d8c9fc0e03539eb38a523fd04d25b338beebe908178ea123562c14df1a23e8fa1122d997c1cc55543353c9756
data/Gemfile.lock CHANGED
@@ -6,9 +6,9 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- power_assert (1.1.3)
10
- rake (12.3.1)
11
- test-unit (3.2.8)
9
+ power_assert (2.0.0)
10
+ rake (12.3.3)
11
+ test-unit (3.4.1)
12
12
  power_assert
13
13
 
14
14
  PLATFORMS
@@ -16,9 +16,9 @@ PLATFORMS
16
16
 
17
17
  DEPENDENCIES
18
18
  array-tweaks!
19
- bundler (~> 1.7)
19
+ bundler (>= 1.7.0, < 3.0.0)
20
20
  rake (~> 12.3)
21
21
  test-unit (~> 3.2)
22
22
 
23
23
  BUNDLED WITH
24
- 1.16.5
24
+ 2.1.4
data/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
  * `each_with_index_and_size`
11
11
  * `each_after`
12
12
  * `map_key`
13
+ * `not_in?`
13
14
 
14
15
  ## Installing gem
15
16
 
data/array-tweaks.gemspec CHANGED
@@ -4,16 +4,16 @@
4
4
  require File.expand_path("../lib/array-tweaks/version", __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "array-tweaks"
8
- s.version = ArrayTweaks::VERSION
9
- s.author = "Yaroslav Konoplov"
10
- s.email = "eahome00@gmail.com"
11
- s.summary = "Utilities for Ruby's array."
12
- s.description = "A gem extending Ruby's array with useful utilities."
13
- s.homepage = "https://github.com/yivo/array-tweaks"
14
- s.license = "MIT"
15
- s.files = `git ls-files -z`.split("\x0")
16
- s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
17
- s.require_paths = ["lib"]
18
- s.add_development_dependency "bundler", "~> 1.7"
7
+ s.name = "array-tweaks"
8
+ s.version = ArrayTweaks::VERSION
9
+ s.author = "Yaroslav Konoplov"
10
+ s.email = "eahome00@gmail.com"
11
+ s.summary = "Utilities for Ruby's array."
12
+ s.description = "A gem extending Ruby's array with useful utilities."
13
+ s.homepage = "https://github.com/yivo/array-tweaks"
14
+ s.license = "MIT"
15
+ s.files = `git ls-files -z`.split("\x0")
16
+ s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
17
+ s.require_paths = ["lib"]
18
+ s.add_development_dependency "bundler", ">= 1.7.0", "< 3.0.0"
19
19
  end
data/lib/array-tweaks.rb CHANGED
@@ -29,3 +29,15 @@ module ArrayTweaks
29
29
  end
30
30
 
31
31
  Array.include ArrayTweaks::Extension
32
+
33
+ module ObjectTweaks
34
+ module Extension
35
+ def not_in?(another_object)
36
+ !another_object.include?(self)
37
+ rescue NoMethodError
38
+ raise ArgumentError, "The parameter passed to #not_in? must respond to #include?."
39
+ end
40
+ end
41
+ end
42
+
43
+ Object.include ObjectTweaks::Extension
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ArrayTweaks
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.3"
6
6
  end
@@ -47,4 +47,9 @@ class ArrayTweaksTest < Test::Unit::TestCase
47
47
  def test_map_key
48
48
  assert_equal ["a", "b", nil, "c"], [{ k: "a" }, { k: "b" }, {}, { k: "c" }].map_key(:k)
49
49
  end
50
+
51
+ def test_not_in
52
+ assert_true "d".not_in? ["a", "b", nil, "c"]
53
+ assert_false "b".not_in? ["a", "b", nil, "c"]
54
+ end
50
55
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: array-tweaks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-08 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: 1.7.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.7.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '1.7'
32
+ version: 3.0.0
27
33
  description: A gem extending Ruby's array with useful utilities.
28
34
  email: eahome00@gmail.com
29
35
  executables: []
@@ -61,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
67
  - !ruby/object:Gem::Version
62
68
  version: '0'
63
69
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.7.6
70
+ rubygems_version: 3.1.6
66
71
  signing_key:
67
72
  specification_version: 4
68
73
  summary: Utilities for Ruby's array.