xqsr3 0.36.0 → 0.37.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 +5 -5
- data/lib/xqsr3/extensions/hash.rb +1 -0
- data/lib/xqsr3/extensions/hash/except.rb +26 -0
- data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +2 -0
- data/lib/xqsr3/string_utilities/quote_if.rb +4 -0
- data/lib/xqsr3/version.rb +3 -3
- data/test/unit/diagnostics/tc_exception_utilities.rb +7 -3
- data/test/unit/extensions/hash/tc_deep_transform.rb +0 -1
- data/test/unit/extensions/hash/tc_except.rb +67 -0
- data/test/unit/extensions/kernel/tc_raise_with_options.rb +6 -3
- data/test/unit/tc_version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '048dfbb7beeff5b7e90df73f59be96e686611f91'
|
4
|
+
data.tar.gz: 815facf131a846b49eec30be5e45bf369383d52d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77733d055c75114bcd38811e5af5f89726c563976d49b8d197246309ac6a2c92ade6cf66e812f81a02b17f682f530b870441fc9f8436b499179dee2165d539c
|
7
|
+
data.tar.gz: 38743b47b07c1b1876d680a759e6c9ec3e9aac7ef6482305a2dbe452fa5d1f28e0bb3b5921653778feb94b76a8f884f90eb03dbae7bad9dd6d5815fad9902308
|
@@ -0,0 +1,26 @@
|
|
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
|
+
|
18
|
+
# Obtains a copy of the instance wherein any key-value pairs
|
19
|
+
# matching the keys specified in +keys_to_delete+ are removed
|
20
|
+
def except(*keys_to_delete)
|
21
|
+
|
22
|
+
self.dup.except!(*keys_to_delete)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -11,9 +11,11 @@ module X_assert_raise_with_message_ # :nodoc: all
|
|
11
11
|
|
12
12
|
if TestUnitVersion_.is_at_least? [ 3, 0, 8 ]
|
13
13
|
|
14
|
+
# @!visibility private
|
14
15
|
AssertionFailedError_ = Test::Unit::AssertionFailedError # :nodoc:
|
15
16
|
else
|
16
17
|
|
18
|
+
# @!visibility private
|
17
19
|
class AssertionFailedError_ < ArgumentError; end # :nodoc:
|
18
20
|
end
|
19
21
|
|
@@ -63,6 +63,8 @@ module QuoteIf
|
|
63
63
|
|
64
64
|
def self.string_quote_if_array_ s, options # :nodoc:
|
65
65
|
|
66
|
+
#$stderr.puts "#{self}#{__method__}(s (#{s.class})='#{s}', options (#{options.class})='#{options}'"
|
67
|
+
|
66
68
|
s = s.to_s unless String === s
|
67
69
|
|
68
70
|
quotes = options[:quotes] || [ '"', '"' ]
|
@@ -70,6 +72,8 @@ module QuoteIf
|
|
70
72
|
|
71
73
|
quotables = options[:quotables] || /\s/
|
72
74
|
|
75
|
+
#$stderr.puts "quotables (#{quotables.class}): [#{quotables}]"
|
76
|
+
|
73
77
|
case quotables
|
74
78
|
when ::String
|
75
79
|
|
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:
|
8
|
+
# Updated: 20th April 2021
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/xqsr3
|
11
11
|
#
|
12
12
|
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
-
# Copyright (c) 2019-
|
14
|
+
# Copyright (c) 2019-2021, 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.
|
54
|
+
VERSION = '0.37.0'
|
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
|
-
|
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] =~
|
220
|
+
assert $@[0] =~ LINE_NUM_RE
|
217
221
|
assert_equal line_number.to_s, $1.to_s
|
218
222
|
end
|
219
223
|
end
|
@@ -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] =~
|
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] =~
|
237
|
+
assert $@[0] =~ LINE_NUM_RE
|
235
238
|
assert_equal line_number.to_s, $1.to_s
|
236
239
|
end
|
237
240
|
end
|
data/test/unit/tc_version.rb
CHANGED
@@ -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.
|
4
|
+
version: 0.37.0
|
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:
|
11
|
+
date: 2021-04-20 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,7 +156,7 @@ 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
|
@@ -169,9 +171,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
171
|
- !ruby/object:Gem::Version
|
170
172
|
version: '0'
|
171
173
|
requirements: []
|
172
|
-
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
174
|
-
signing_key:
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 2.6.14.3
|
176
|
+
signing_key:
|
175
177
|
specification_version: 4
|
176
178
|
summary: xqsr3
|
177
179
|
test_files: []
|