rr 3.0.9 → 3.1.1

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: 1053e9c05c201e89415c92c0751d397aeb0cf54c122156b572f92b882ffa24a8
4
- data.tar.gz: 197c473a885192c537f2d3eb68aa8e0efb8b3f4a88e089385cf396c7433c214e
3
+ metadata.gz: 553699e59756c142c1c363a437e48fa1357d481b8e73ca00e92f837da6e6a040
4
+ data.tar.gz: 02a6de6989f0a1a95a6c684c767d3219945ffb5135e234bc6396af8374fcea72
5
5
  SHA512:
6
- metadata.gz: 4e90a367b42a7a0a4ef9d68296c0ffa65450b16b2bceb04347210ae15796b90857e42ae3c960a7720808e6cf3172320d985357096ec334aa42b435c98b6ef691
7
- data.tar.gz: 856409966ac4f007b3f397c729978b8547c12f924aac17d92d30fc830f1fd6bb0266d228c772cf750aaffae20b3102deb84a7b77a37fc14cafedd2a63d2a2e64
6
+ metadata.gz: 872f9c50bff0a9f2cd5122e90d93b28c7f27c7486cea0f5786924c7289a0a74011e2c7cd26b5b1b052dbdcbebd8bbd3f7634dfcf43934a8cc68b0e1ab673b3c2
7
+ data.tar.gz: b5f02e68c5c312df34af33a27ba0f435b2c4cf04c1e1f242b7364114f74ac6f39a6d2983fa21cb1eb24eb213196575ed25b429be0148a9ed52b1efd89eacf95f
data/CHANGES.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.1 - 2024-08-30
4
+
5
+ ### Improvements
6
+
7
+ * Suppressed a warning:
8
+ * GH-99
9
+ * Patch by Kevin Newton
10
+
11
+ ### Thanks
12
+
13
+ * Kevin Newton
14
+
15
+ ## 3.1.0 - 2022-07-14
16
+
17
+ ### Improvements
18
+
19
+ * Improved CI.
20
+ [GitHub#89](https://github.com/rr/rr/pull/89)[Patch by Peter Goldstein]
21
+ [GitHub#90](https://github.com/rr/rr/pull/90)[Patch by mishina]
22
+ [GitHub#91](https://github.com/rr/rr/pull/91)[Patch by mishina]
23
+
24
+ * Improved `wildcard_match?` against `Hash`.
25
+ [GitHub#94](https://github.com/rr/rr/issues/94)
26
+ [Reported by kawamotosatoshi]
27
+
28
+ ### Fixes
29
+
30
+ * Fixed document.
31
+ [GitHub#92](https://github.com/rr/rr/pull/92)[Patch by mishina]
32
+
33
+ ### Thanks
34
+
35
+ * Peter Goldstein
36
+
37
+ * mishina
38
+
39
+ * kawamotosatoshi
40
+
3
41
  ## 3.0.9 - 2021-12-07
4
42
 
5
43
  ### Improvements
@@ -100,7 +138,7 @@
100
138
  ### Improvements
101
139
 
102
140
  * Added support for Ruby 3.0's keyword arguments.
103
- [GitHub#17][Reported by Takuro Ashie]
141
+ [GitHub#77][Reported by Takuro Ashie]
104
142
 
105
143
  ### Fixes
106
144
 
@@ -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
@@ -74,12 +74,12 @@ module RR
74
74
 
75
75
  def extract_subject_from_return_value(return_value)
76
76
  case return_value
77
- when DoubleDefinitions::DoubleDefinition
78
- return_value.root_subject
79
- when DoubleDefinitions::DoubleDefinitionCreateBlankSlate
80
- return_value.__double_definition_create__.root_subject
81
- else
82
- return_value
77
+ when DoubleDefinitions::DoubleDefinition
78
+ return_value.root_subject
79
+ when DoubleDefinitions::DoubleDefinitionCreateBlankSlate
80
+ return_value.__double_definition_create__.root_subject
81
+ else
82
+ return_value
83
83
  end
84
84
  end
85
85
 
data/lib/rr/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module RR
2
- VERSION = '3.0.9'.freeze
2
+ VERSION = '3.1.1'.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,16 +1,15 @@
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Brian Takita
9
9
  - Elliot Winkler
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2021-12-07 00:00:00.000000000 Z
12
+ date: 2024-08-29 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: bundler
@@ -347,7 +346,6 @@ homepage: https://rr.github.io/rr
347
346
  licenses:
348
347
  - MIT
349
348
  metadata: {}
350
- post_install_message:
351
349
  rdoc_options: []
352
350
  require_paths:
353
351
  - lib
@@ -362,8 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
360
  - !ruby/object:Gem::Version
363
361
  version: '0'
364
362
  requirements: []
365
- rubygems_version: 3.3.0.dev
366
- signing_key:
363
+ rubygems_version: 3.6.0.dev
367
364
  specification_version: 4
368
365
  summary: RR is a test double framework that features a rich selection of double techniques
369
366
  and a terse syntax.