array_include_methods 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 464cd95859200569276f7df56c046348abdfa36a0c6674dd44d026f95cd520d7
4
+ data.tar.gz: 6ccb6950c545d4623403da76a40f43e16dc4b8f818b5a54144a7bd38ce7b3aa8
5
+ SHA512:
6
+ metadata.gz: bb21245c8ead69fb5edca573721c06f556954bf0eef71421d329944a789cfe5de285911df1e03c463d71cfb0514a134e87d60d8a4cd9b23aa915a6988d629b98
7
+ data.tar.gz: a0c2f9c11c53c3859fd809faa132aa5318e15359b649b3e749495267f07ee01de862eb029fe92a194e95cee9600a36694b2b4922b584153f04fe4b8e84704c35
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2020 Andy Maleh
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ # ArrayIncludeMethods - Ruby Refinement
2
+ [![Gem Version](https://badge.fury.io/rb/array_include_methods.svg)](http://badge.fury.io/rb/array_include_methods)
3
+
4
+ `Array#include_all?` & `Array#include_any?` methods missing from basic Ruby `Array` API.
5
+
6
+ ## Setup
7
+
8
+ ### With Bundler:
9
+
10
+ Include the following in Gemfile:
11
+
12
+ ```ruby
13
+ gem 'array_include_methods', '~> 1.0.0'
14
+ ```
15
+
16
+ Run:
17
+
18
+ ```
19
+ bundle
20
+ ```
21
+
22
+ ### Without Bundler:
23
+
24
+ Run:
25
+
26
+ ```
27
+ gem install array_include_methods -v1.0.0
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Add the following line to your application if you are not requiring all gems via Bundler (e.g. `Bundler.require(:default)`):
33
+
34
+ ```ruby
35
+ require 'array_include_methods'
36
+ ```
37
+
38
+ To activate the `ArrayIncludeMethods` Ruby Refinement for the `Array` class, add the following line to every Ruby file that needs it:
39
+
40
+ ```ruby
41
+ using ArrayIncludeMethods
42
+ ```
43
+
44
+ ## Contributing to array_include_methods
45
+
46
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
47
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
48
+ * Fork the project.
49
+ * Start a feature/bugfix branch.
50
+ * Commit and push until you are happy with your contribution.
51
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
52
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
53
+
54
+ ## Copyright
55
+
56
+ Copyright (c) 2020 Andy Maleh. See LICENSE.txt for
57
+ further details.
@@ -0,0 +1,19 @@
1
+ module ArrayIncludeMethods
2
+ refine Array do
3
+ # Returns `true` if all of the given `array` elements are present in `self`,
4
+ # otherwise returns `false`
5
+ # Always returns `true` if the given `array` is empty
6
+ # Always returns `false` if the given `array` is nil
7
+ def include_all?(array)
8
+ !array.nil? && self & array == array
9
+ end
10
+
11
+ # Returns `true` if any of the given `array` elements are present in `self`,
12
+ # otherwise returns `false`
13
+ # Always returns `true` if the given `array` is empty
14
+ # Always returns `false` if the given `array` is nil
15
+ def include_any?(array)
16
+ !array.nil? && (array.empty? || !(self & array).empty?)
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: array_include_methods
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andy Maleh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jeweler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.3.9
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.9
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Array#include_all? & Array#include_any? methods missing from basic Ruby
70
+ Array API
71
+ email: andy.am@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.md
77
+ files:
78
+ - LICENSE.txt
79
+ - README.md
80
+ - lib/array_include_methods.rb
81
+ homepage: http://github.com/AndyObtiva/array_include_methods
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.1.2
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Array#include_all? & Array#include_any? methods missing from basic Ruby Array
104
+ API
105
+ test_files: []