rr 3.0.9 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1053e9c05c201e89415c92c0751d397aeb0cf54c122156b572f92b882ffa24a8
4
- data.tar.gz: 197c473a885192c537f2d3eb68aa8e0efb8b3f4a88e089385cf396c7433c214e
3
+ metadata.gz: 0d71cc71b67af7c0225441915cc94cdd540a8e7a5c4ac697419af1085fc4d668
4
+ data.tar.gz: 134e2e47decbf840ab066db584a0ebc35806478515844febc7e461da7f7498e7
5
5
  SHA512:
6
- metadata.gz: 4e90a367b42a7a0a4ef9d68296c0ffa65450b16b2bceb04347210ae15796b90857e42ae3c960a7720808e6cf3172320d985357096ec334aa42b435c98b6ef691
7
- data.tar.gz: 856409966ac4f007b3f397c729978b8547c12f924aac17d92d30fc830f1fd6bb0266d228c772cf750aaffae20b3102deb84a7b77a37fc14cafedd2a63d2a2e64
6
+ metadata.gz: 727be4c51bade728231983816ce4cbb4d95e37adbaffc09c0186c6cdee2589b1aa0fc431c14f5b64772e24a8bdc503da4e641871c3764e528c78fc7efac3845a
7
+ data.tar.gz: 0f9da75d9ca9e34d98f3bba0dd46efa4a90da791981a76d79c3addb5896da25086909afb3413ecf3af6d9889348c29e6a3c9ee6366b1b993c3081cb8cce0a9da
data/CHANGES.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0 - 2022-07-14
4
+
5
+ ### Improvements
6
+
7
+ * Improved CI.
8
+ [GitHub#89](https://github.com/rr/rr/pull/89)[Patch by Peter Goldstein]
9
+ [GitHub#90](https://github.com/rr/rr/pull/90)[Patch by mishina]
10
+ [GitHub#91](https://github.com/rr/rr/pull/91)[Patch by mishina]
11
+
12
+ * Improved `wildcard_match?` against `Hash`.
13
+ [GitHub#94](https://github.com/rr/rr/issues/94)
14
+ [Reported by kawamotosatoshi]
15
+
16
+ ### Fixes
17
+
18
+ * Fixed document.
19
+ [GitHub#92](https://github.com/rr/rr/pull/92)[Patch by mishina]
20
+
21
+ ### Thanks
22
+
23
+ * Peter Goldstein
24
+
25
+ * mishina
26
+
27
+ * kawamotosatoshi
28
+
3
29
  ## 3.0.9 - 2021-12-07
4
30
 
5
31
  ### Improvements
@@ -100,7 +126,7 @@
100
126
  ### Improvements
101
127
 
102
128
  * Added support for Ruby 3.0's keyword arguments.
103
- [GitHub#17][Reported by Takuro Ashie]
129
+ [GitHub#77][Reported by Takuro Ashie]
104
130
 
105
131
  ### Fixes
106
132
 
@@ -2,21 +2,40 @@ class Hash
2
2
  def wildcard_match?(other)
3
3
  return false unless other.is_a?(Hash)
4
4
 
5
- other_keys = other.keys
6
- return false if keys.size != other_keys.size
5
+ return false if size != other.size
7
6
 
8
- other_values = other.values
9
- each_with_index do |(key, value), i|
10
- if key.respond_to?(:wildcard_match?)
11
- return false unless key.wildcard_match?(other_keys[i])
12
- else
13
- return false unless key == other_keys[i]
14
- end
7
+ wildcards, exacts = partition {|key, _| key.respond_to?(:wildcard_match?)}
8
+ other = other.dup
9
+ exacts.each do |key, value|
10
+ return false unless other.key?(key)
11
+ other_value = other.delete(key)
15
12
  if value.respond_to?(:wildcard_match?)
16
- return false unless value.wildcard_match?(other_values[i])
13
+ return false unless value.wildcard_match?(other_value)
17
14
  else
18
- return false unless value == other_values[i]
15
+ return false unless value == other_value
19
16
  end
20
17
  end
18
+ # TODO: Add support for the following case:
19
+ # {
20
+ # is_a(Symbol) => anything,
21
+ # is_a(Symbol) => 1,
22
+ # }.wildcard_match?(d: 1, c: 3)
23
+ wildcards.each do |key, value|
24
+ found = false
25
+ other.each do |other_key, other_value|
26
+ next unless key.wildcard_match?(other_key)
27
+ if value.respond_to?(:wildcard_match?)
28
+ next unless value.wildcard_match?(other_value)
29
+ else
30
+ next unless value == other_value
31
+ end
32
+ other.delete(other_key)
33
+ found = true
34
+ break
35
+ end
36
+ return false unless found
37
+ end
38
+
39
+ true
21
40
  end
22
41
  end
data/lib/rr/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module RR
2
- VERSION = '3.0.9'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  def self.version; VERSION; end
4
4
  end
data/rr.gemspec CHANGED
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rake'
4
3
  require File.expand_path('../lib/rr/version', __FILE__)
5
4
 
6
5
  Gem::Specification.new do |gem|
@@ -13,7 +12,7 @@ Gem::Specification.new do |gem|
13
12
  gem.homepage = 'https://rr.github.io/rr'
14
13
  gem.license = 'MIT'
15
14
 
16
- gem.files = FileList[
15
+ gem.files = Dir[
17
16
  'Appraisals',
18
17
  'CHANGES.md',
19
18
  'CREDITS.md',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rr
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-12-07 00:00:00.000000000 Z
13
+ date: 2022-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -362,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
362
  - !ruby/object:Gem::Version
363
363
  version: '0'
364
364
  requirements: []
365
- rubygems_version: 3.3.0.dev
365
+ rubygems_version: 3.4.0.dev
366
366
  signing_key:
367
367
  specification_version: 4
368
368
  summary: RR is a test double framework that features a rich selection of double techniques