xqsr3 0.36.0 → 0.37.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
- SHA256:
3
- metadata.gz: 4e3f5e422b5b6d6f88ee0c0eb620f38ce468ef54e1cf9d55ab41f24e909c897b
4
- data.tar.gz: 80f3675582a96f52a108687c4a77911691972dd0a2167138ffa0c9992c13e3ed
2
+ SHA1:
3
+ metadata.gz: f10bad46d3e4578fbf386537a6bf5e72e4b690d7
4
+ data.tar.gz: 71706b979d66b50232e82fe32259e4c69c1dd697
5
5
  SHA512:
6
- metadata.gz: 41b2ac34f613f74b684223073ff61c3350b8433bda18520bb0af25db2464a22ed1be8fe53859eaf37f60d366d7053d8cab77d653b45b33a57ebd1a619b6186c6
7
- data.tar.gz: 28d271b3501677420540ec6a55b1bf69bedf398dc422362ff7ca5e50e1d827d4f4fccc45c73eece170949bab755a47472d78f207a0b7c992cb942b13d368be76
6
+ metadata.gz: c1cf52793a168a5be1102777e347b657fc12dab1549321fd028e66fa2c64523651b66c8c9669d17079b4824309a0217063c6876b82f0d44c1b909973478e88e1
7
+ data.tar.gz: 076ce8d398e4b0f67012bf6465b9a1ba005ef4d6fe60bc60736b42ea9269448535df9677da2702ac1b9c868f6f2bd3560dd92f2815d7c4cfc7fb20438f0a3528
@@ -0,0 +1,32 @@
1
+
2
+ unless Hash.instance_methods.include? :except!
3
+
4
+ class Hash
5
+
6
+ # Removes from the instance any key-value pairs matching the
7
+ # keys specified in +keys_to_delete+
8
+ def except!(*keys_to_delete)
9
+
10
+ keys_to_delete.each do |key|
11
+
12
+ self.delete key
13
+ end
14
+
15
+ self
16
+ end
17
+ end
18
+ end
19
+
20
+ unless Hash.instance_methods.include? :except
21
+
22
+ class Hash
23
+
24
+ # Obtains a copy of the instance wherein any key-value pairs
25
+ # matching the keys specified in +keys_to_delete+ are removed
26
+ def except(*keys_to_delete)
27
+
28
+ self.dup.except!(*keys_to_delete)
29
+ end
30
+ end
31
+ end
32
+
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'xqsr3/extensions/hash/deep_transform'
3
+ require 'xqsr3/extensions/hash/except'
3
4
  require 'xqsr3/extensions/hash/has_match'
4
5
  require 'xqsr3/extensions/hash/match'
5
6
 
data/lib/xqsr3/version.rb CHANGED
@@ -5,13 +5,13 @@
5
5
  # Purpose: Version for Xqsr3 library
6
6
  #
7
7
  # Created: 3rd April 2016
8
- # Updated: 26th May 2020
8
+ # Updated: 26th June 2022
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
14
+ # Copyright (c) 2019-2022, Matthew Wilson and Synesis Information Systems
15
15
  # Copyright (c) 2016-2019, Matthew Wilson and Synesis Software
16
16
  # All rights reserved.
17
17
  #
@@ -51,7 +51,7 @@
51
51
  module Xqsr3
52
52
 
53
53
  # Current version of the Xqsr3 library
54
- VERSION = '0.36.0'
54
+ VERSION = '0.37.2'
55
55
 
56
56
  private
57
57
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -10,6 +10,9 @@ class Test_ExceptionUtilities_raise_with_options < Test::Unit::TestCase
10
10
 
11
11
  include ::Xqsr3::Diagnostics
12
12
 
13
+ OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(mswin|mingw|bccwin|wince)/i) ? true : false
14
+ LINE_NUM_RE = OS_IS_WINDOWS ? /.+:(\d+):/ : /^[^:]+:(\d+)/
15
+
13
16
  class ArgumentErrorWithOptions < ArgumentError
14
17
  def initialize(message = nil, **options)
15
18
  super(message)
@@ -25,7 +28,7 @@ class Test_ExceptionUtilities_raise_with_options < Test::Unit::TestCase
25
28
 
26
29
  msg ||= self.message
27
30
  options ||= {}
28
- r = self.class.new msg, self.options.merge(options)
31
+ r = self.class.new msg, **self.options.merge(options)
29
32
  r
30
33
  end
31
34
  end
@@ -192,7 +195,8 @@ class Test_ExceptionUtilities_raise_with_options < Test::Unit::TestCase
192
195
  assert_kind_of(ArgumentError, x)
193
196
  assert_equal "abc", x.message
194
197
 
195
- assert $@[0] =~ /^[^:]+:(\d+)/
198
+
199
+ assert $@[0] =~ LINE_NUM_RE
196
200
  assert_equal line_number.to_s, $1.to_s
197
201
  end
198
202
 
@@ -213,7 +217,7 @@ class Test_ExceptionUtilities_raise_with_options < Test::Unit::TestCase
213
217
  assert_equal "abc", x.message
214
218
  assert_equal ({ :blah => :blech, :id => 23 }), x.options
215
219
 
216
- assert $@[0] =~ /^[^:]+:(\d+)/
220
+ assert $@[0] =~ LINE_NUM_RE
217
221
  assert_equal line_number.to_s, $1.to_s
218
222
  end
219
223
  end
@@ -46,4 +46,3 @@ class Test_Hash_deep_transform < Test::Unit::TestCase
46
46
  end
47
47
 
48
48
 
49
-
@@ -0,0 +1,67 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/hash/except'
6
+
7
+ require 'xqsr3/extensions/test/unit'
8
+ require 'test/unit'
9
+
10
+ require 'stringio'
11
+
12
+ class Test_Hash_except < Test::Unit::TestCase
13
+
14
+ def test_no_pairs_empty_keys
15
+
16
+ h = {}
17
+
18
+ assert_equal h, h.except([])
19
+
20
+ i = {}
21
+
22
+ i.except! *[]
23
+
24
+ assert_equal h, i
25
+ end
26
+
27
+ def test_no_pairs_some_keys
28
+
29
+ h = {}
30
+
31
+ assert_equal h, h.except('a', :b)
32
+
33
+ i = {}
34
+
35
+ i.except! 'a', :b
36
+
37
+ assert_equal h, i
38
+ end
39
+
40
+ def test_no_pairs_some_non_matching_keys
41
+
42
+ h = { a: 'a', 'b' => :b }
43
+
44
+ assert_equal h, h.except('a', :b)
45
+
46
+ i = h.dup
47
+
48
+ i.except! 'a', :b
49
+
50
+ assert_equal h, i
51
+ end
52
+
53
+ def test_no_pairs_some_matching_keys
54
+
55
+ h = { a: 'a', 'b' => :b }
56
+
57
+ assert_equal ({ 'b' => :b }), h.except(:a, :b, :c)
58
+
59
+ i = h.dup
60
+
61
+ i.except! :a, :b, :c
62
+
63
+ assert_equal ({ 'b' => :b }), i
64
+ end
65
+ end
66
+
67
+
@@ -8,6 +8,9 @@ require 'test/unit'
8
8
 
9
9
  class Test_X_Kernel_raise_with_options < Test::Unit::TestCase
10
10
 
11
+ OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(mswin|mingw|bccwin|wince)/i) ? true : false
12
+ LINE_NUM_RE = OS_IS_WINDOWS ? /.+:(\d+):/ : /^[^:]+:(\d+)/
13
+
11
14
  class ArgumentErrorWithOptions < ArgumentError
12
15
 
13
16
  def initialize(message = nil, **options)
@@ -25,7 +28,7 @@ class Test_X_Kernel_raise_with_options < Test::Unit::TestCase
25
28
 
26
29
  msg ||= self.message
27
30
  options ||= {}
28
- r = self.class.new msg, self.options.merge(options)
31
+ r = self.class.new msg, **self.options.merge(options)
29
32
  r
30
33
  end
31
34
  end
@@ -207,7 +210,7 @@ class Test_X_Kernel_raise_with_options < Test::Unit::TestCase
207
210
  assert_kind_of(ArgumentError, x)
208
211
  assert_equal "abc", x.message
209
212
 
210
- assert $@[0] =~ /^[^:]+:(\d+)/
213
+ assert $@[0] =~ LINE_NUM_RE
211
214
  assert_equal line_number.to_s, $1.to_s
212
215
  end
213
216
 
@@ -231,7 +234,7 @@ class Test_X_Kernel_raise_with_options < Test::Unit::TestCase
231
234
  assert_equal "abc", x.message
232
235
  assert_equal ({ :blah => :blech, :id => 23 }), x.options
233
236
 
234
- assert $@[0] =~ /^[^:]+:(\d+)/
237
+ assert $@[0] =~ LINE_NUM_RE
235
238
  assert_equal line_number.to_s, $1.to_s
236
239
  end
237
240
  end
@@ -30,7 +30,7 @@ class Test_version < Test::Unit::TestCase
30
30
 
31
31
  def test_VERSION_has_consistent_format
32
32
 
33
- assert_equal Xqsr3::VERSION, "#{Xqsr3::VERSION_MAJOR}.#{Xqsr3::VERSION_MINOR}.#{Xqsr3::VERSION_REVISION}"
33
+ assert_equal Xqsr3::VERSION.split('.')[0..2].join('.'), "#{Xqsr3::VERSION_MAJOR}.#{Xqsr3::VERSION_MINOR}.#{Xqsr3::VERSION_REVISION}"
34
34
  end
35
35
  end
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xqsr3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.37.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-26 00:00:00.000000000 Z
11
+ date: 2022-06-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  eXtensions by fine Quantum for Standard Ruby and 3rd-party libraries is a
@@ -48,6 +48,7 @@ files:
48
48
  - lib/xqsr3/extensions/enumerable/unique.rb
49
49
  - lib/xqsr3/extensions/hash.rb
50
50
  - lib/xqsr3/extensions/hash/deep_transform.rb
51
+ - lib/xqsr3/extensions/hash/except.rb
51
52
  - lib/xqsr3/extensions/hash/has_match.rb
52
53
  - lib/xqsr3/extensions/hash/match.rb
53
54
  - lib/xqsr3/extensions/hash/slice.rb
@@ -113,6 +114,7 @@ files:
113
114
  - test/unit/extensions/enumerable/tc_unique.rb
114
115
  - test/unit/extensions/enumerable/ts_all.rb
115
116
  - test/unit/extensions/hash/tc_deep_transform.rb
117
+ - test/unit/extensions/hash/tc_except.rb
116
118
  - test/unit/extensions/hash/tc_hash.rb
117
119
  - test/unit/extensions/hash/tc_slice.rb
118
120
  - test/unit/extensions/hash/ts_all.rb
@@ -154,24 +156,27 @@ homepage: http://github.com/synesissoftware/xqsr3
154
156
  licenses:
155
157
  - BSD-3-Clause
156
158
  metadata: {}
157
- post_install_message:
159
+ post_install_message:
158
160
  rdoc_options: []
159
161
  require_paths:
160
162
  - lib
161
163
  required_ruby_version: !ruby/object:Gem::Requirement
162
164
  requirements:
163
- - - "~>"
165
+ - - ">="
164
166
  - !ruby/object:Gem::Version
165
167
  version: '2.0'
168
+ - - "<"
169
+ - !ruby/object:Gem::Version
170
+ version: '4'
166
171
  required_rubygems_version: !ruby/object:Gem::Requirement
167
172
  requirements:
168
173
  - - ">="
169
174
  - !ruby/object:Gem::Version
170
175
  version: '0'
171
176
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.7.6
174
- signing_key:
177
+ rubyforge_project:
178
+ rubygems_version: 2.6.14.3
179
+ signing_key:
175
180
  specification_version: 4
176
181
  summary: xqsr3
177
182
  test_files: []