array_include_methods 1.0.3 → 1.0.4

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: 5603fedac664220b84ce316fe3e737e15379c84a94c924d4f257b73c89964823
4
- data.tar.gz: 5fa5f34ae91a0a3a3c12d475a28a857b02975aa69224bd710ae9887cf1108df5
3
+ metadata.gz: 7ddeb62919efd84e6bfe45c278769d00ffc9d824a662d59c6f66a2d07af634ff
4
+ data.tar.gz: bb74486e281c925702761a5a83ae47804f326ebbb05b09b6275ad0dee6999634
5
5
  SHA512:
6
- metadata.gz: 6205f364915b17f92e06dc3d78f76a3c829355f18ee2620879ceb2315c2e611082ada3ffaedd0ebc877781c3b37991d61addc078ce9ea419d2ed219169c5fb23
7
- data.tar.gz: a66add1a0b81a5bce966c7b1cf3fde24dde7a93f08f1152d1bccae3ff48d3b012a9eb91421ebe446f1609d4d094922d4aa62d14c0cdcbd02575772cb513207ca
6
+ metadata.gz: ead0318fcb6aff83e48151fb1925c708af07430198c23366ce1415d7b4e1e58266484f4e76352c36480d1a59e6cc2469f255e0c3419e5a1ca485bf22aa45276d
7
+ data.tar.gz: fa6628a52ceb617d01cf40b5a88f6ce8c45f88ce117e605ade63f077d08df49501938fb92c234d2156babada06e76af79183d7260cfc838b3386ec2e210d7848
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.0.4
4
+
5
+ - Support splat args (e.g. `include_any?(1, 2, 3)` instead of `include_any?([1, 2, 3])`)
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  - Opal compatibility through monkey-patching and providing a `using` method shim so that existing gems that used the refinement in Ruby work
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ArrayIncludeMethods 1.0.3 - Ruby Refinement
1
+ # ArrayIncludeMethods 1.0.4 - Ruby Refinement
2
2
  [![Gem Version](https://badge.fury.io/rb/array_include_methods.svg)](http://badge.fury.io/rb/array_include_methods)
3
3
  [![Build Status](https://travis-ci.com/AndyObtiva/array_include_methods.svg?branch=master)](https://travis-ci.com/AndyObtiva/array_include_methods)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/array_include_methods/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/array_include_methods?branch=master)
@@ -12,7 +12,7 @@
12
12
  Include the following in Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'array_include_methods', '~> 1.0.3'
15
+ gem 'array_include_methods', '~> 1.0.4'
16
16
  ```
17
17
 
18
18
  Run:
@@ -26,7 +26,7 @@ bundle
26
26
  Run:
27
27
 
28
28
  ```
29
- gem install array_include_methods -v1.0.3
29
+ gem install array_include_methods -v1.0.4
30
30
  ```
31
31
 
32
32
  ## Usage
@@ -51,7 +51,9 @@ Now, you have `#include_all?` and `#include_any?` methods on `Array` objects.
51
51
 
52
52
  ```ruby
53
53
  [1, 2, 3, 4].include_all?([2, 4]) # returns true
54
+ [1, 2, 3, 4].include_all?(2, 4) # returns true
54
55
  [1, 2, 3, 4].include_all?([2, 4, 5]) # returns false
56
+ [1, 2, 3, 4].include_all?(2, 4, 5) # returns false
55
57
  [1, 2, 3, 4].include_all?([]) # returns true
56
58
  [1, 2, 3, 4].include_all?(nil) # returns false
57
59
  ```
@@ -60,7 +62,9 @@ Now, you have `#include_all?` and `#include_any?` methods on `Array` objects.
60
62
 
61
63
  ```ruby
62
64
  [1, 2, 3, 4].include_any?([2, 4, 5]) # returns true
65
+ [1, 2, 3, 4].include_any?(2, 4, 5) # returns true
63
66
  [1, 2, 3, 4].include_any?([6, 7]) # returns false
67
+ [1, 2, 3, 4].include_any?(6, 7) # returns false
64
68
  [1, 2, 3, 4].include_any?([]) # returns true
65
69
  [1, 2, 3, 4].include_any?(nil) # returns false
66
70
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: array_include_methods 1.0.3 ruby lib
5
+ # stub: array_include_methods 1.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "array_include_methods".freeze
9
- s.version = "1.0.3"
9
+ s.version = "1.0.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Andy Maleh".freeze]
14
- s.date = "2020-09-29"
14
+ s.date = "2020-11-15"
15
15
  s.description = "Array#include_all? & Array#include_any? methods missing from basic Ruby Array API".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -9,7 +9,8 @@ module ArrayIncludeMethods
9
9
  # otherwise returns `false`
10
10
  # Always returns `true` if the given `array` is empty
11
11
  # Always returns `false` if the given `array` is nil
12
- def include_all?(array)
12
+ def include_all?(*array)
13
+ array = array[0] if array.size == 1 && array[0].is_a?(Array)
13
14
  return false if array.nil?
14
15
  array_include_other_array_same_class_elements = lambda do |a1, a2|
15
16
  begin
@@ -33,9 +34,10 @@ module ArrayIncludeMethods
33
34
  # otherwise returns `false`
34
35
  # Always returns `true` if the given `array` is empty
35
36
  # Always returns `false` if the given `array` is nil
36
- def include_any?(array)
37
+ def include_any?(*array)
38
+ array = array[0] if array.size == 1 && array[0].is_a?(Array)
37
39
  !array.nil? && (array.empty? || !(self & array).empty?)
38
- end
40
+ end
39
41
  end
40
42
  end
41
43
  if RUBY_PLATFORM == 'opal'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: array_include_methods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec