array_include_methods 1.0.1 → 1.0.2

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: 23f887c53772d4bcdbd1b1d8ba7c6bfc288e0d2a240c4964d14f623ff0e06151
4
- data.tar.gz: 755c0b44e13e6630f2692ac28ad64edaee7ac36586c6b68a6cedf4a5841dae3c
3
+ metadata.gz: 1c2ea9883b39246baae032b965a82ae5d6cec5f15393ffa3e8c68e698a0cb6d3
4
+ data.tar.gz: a8e2cfeef8241433ad043c358d285d349ee4ba8ea2b40b73dcb4863e30f0fd7c
5
5
  SHA512:
6
- metadata.gz: 1ddb16dbc31b74e3c5f367a164658326f2f1049cf0d4c50005ea2857f02e06264589ffe0ada88a34af0edab50131cd897776e4b880d9b8e057b23c067fefc4ec
7
- data.tar.gz: 801e45a2e0780f17a248063d4093828a36301d1f78a9ef3875698c8ccfbda6f7fc49a99645131208669de42164ab2428fbd201b755f6f034826baa138ece7904
6
+ metadata.gz: 2ad14e48a3d730fef05fad287cd3232b052462961ec91a4094713b2dc80803806e99bc3b52e1e80ce0638b6f8e833fb757132c2646037d791a8faefb78c2802a
7
+ data.tar.gz: 15f9bac604634a862cf1d582c26523ef375659371fb3151a8b69c2158b4e75c58b17d202753b85b1c4060016274813d4e2f1b68a75fbc805b616efbd211b9f4a
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ArrayIncludeMethods 1.0.1 - Ruby Refinement
1
+ # ArrayIncludeMethods 1.0.2 - 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
 
4
4
  `Array#include_all?` & `Array#include_any?` methods missing from basic Ruby `Array` API.
@@ -10,7 +10,7 @@
10
10
  Include the following in Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'array_include_methods', '~> 1.0.1'
13
+ gem 'array_include_methods', '~> 1.0.2'
14
14
  ```
15
15
 
16
16
  Run:
@@ -24,7 +24,7 @@ bundle
24
24
  Run:
25
25
 
26
26
  ```
27
- gem install array_include_methods -v1.0.1
27
+ gem install array_include_methods -v1.0.2
28
28
  ```
29
29
 
30
30
  ## Usage
@@ -65,6 +65,10 @@ Now, you have `#include_all?` and `#include_any?` methods on `Array` objects.
65
65
 
66
66
  ## Change Log
67
67
 
68
+ ### 1.0.2
69
+
70
+ - Handled case of two arrays with elements of unsortable object types (e.g. Hash)
71
+
68
72
  ### 1.0.1
69
73
 
70
74
  - Handled case of two arrays with different ordering of common elements
@@ -7,7 +7,11 @@ module ArrayIncludeMethods
7
7
  def include_all?(array)
8
8
  return false if array.nil?
9
9
  array_include_other_array_same_class_elements = lambda do |a1, a2|
10
- (a1 & a2).uniq.sort == a2.uniq.sort
10
+ begin
11
+ (a1 & a2).uniq.sort == a2.uniq.sort
12
+ rescue ArgumentError => e
13
+ a2.uniq.reduce(true) { |result, element| result && a1.include?(element) }
14
+ end
11
15
  end
12
16
  self_grouped_by = self.group_by(&:class)
13
17
  array_grouped_by = array.group_by(&:class)
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.1
4
+ version: 1.0.2
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-06-01 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec