xqsr3 0.38.1.1 → 0.39.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -6
- data/examples/count_word_frequencies.md +13 -13
- data/examples/count_word_frequencies.rb +5 -5
- data/lib/xqsr3/array_utilities/join_with_or.rb +53 -54
- data/lib/xqsr3/array_utilities.rb +2 -2
- data/lib/xqsr3/command_line_utilities/map_option_string.rb +66 -67
- data/lib/xqsr3/command_line_utilities.rb +2 -2
- data/lib/xqsr3/containers/frequency_map.rb +405 -404
- data/lib/xqsr3/containers/multi_map.rb +454 -453
- data/lib/xqsr3/containers.rb +3 -3
- data/lib/xqsr3/conversion/bool_parser.rb +56 -57
- data/lib/xqsr3/conversion/integer_parser.rb +92 -93
- data/lib/xqsr3/conversion.rb +3 -3
- data/lib/xqsr3/diagnostics/exception_utilities.rb +152 -151
- data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +99 -95
- data/lib/xqsr3/diagnostics/inspect_builder.rb +86 -86
- data/lib/xqsr3/diagnostics.rb +3 -3
- data/lib/xqsr3/doc_.rb +136 -136
- data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
- data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +18 -17
- data/lib/xqsr3/extensions/enumerable/detect_map.rb +41 -41
- data/lib/xqsr3/extensions/enumerable/unique.rb +32 -31
- data/lib/xqsr3/extensions/hash/deep_transform.rb +1 -1
- data/lib/xqsr3/extensions/hash/except.rb +16 -16
- data/lib/xqsr3/extensions/hash/has_match.rb +10 -10
- data/lib/xqsr3/extensions/hash/match.rb +10 -10
- data/lib/xqsr3/extensions/hash/slice.rb +11 -11
- data/lib/xqsr3/extensions/hash.rb +1 -1
- data/lib/xqsr3/extensions/integer/to_s_grp.rb +118 -0
- data/lib/xqsr3/extensions/integer.rb +3 -0
- data/lib/xqsr3/extensions/io/writelines.rb +34 -34
- data/lib/xqsr3/extensions/kernel/integer.rb +26 -26
- data/lib/xqsr3/extensions/kernel/raise_with_options.rb +15 -14
- data/lib/xqsr3/extensions/kernel.rb +1 -0
- data/lib/xqsr3/extensions/string/ends_with.rb +1 -1
- data/lib/xqsr3/extensions/string/map_option_string.rb +4 -5
- data/lib/xqsr3/extensions/string/nil_if_empty.rb +1 -1
- data/lib/xqsr3/extensions/string/nil_if_whitespace.rb +1 -1
- data/lib/xqsr3/extensions/string/quote_if.rb +1 -2
- data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
- data/lib/xqsr3/extensions/string/to_bool.rb +8 -9
- data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
- data/lib/xqsr3/extensions/string/truncate.rb +1 -2
- data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -7
- data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -7
- data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -62
- data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -8
- data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -8
- data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -7
- data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -38
- data/lib/xqsr3/extensions.rb +5 -5
- data/lib/xqsr3/hash_utilities/deep_transform.rb +71 -71
- data/lib/xqsr3/hash_utilities/key_matching.rb +82 -82
- data/lib/xqsr3/hash_utilities.rb +3 -3
- data/lib/xqsr3/internal_/test_unit_version_.rb +130 -88
- data/lib/xqsr3/io/writelines.rb +125 -125
- data/lib/xqsr3/quality/parameter_checking.rb +452 -453
- data/lib/xqsr3/quality.rb +2 -2
- data/lib/xqsr3/string_utilities/ends_with.rb +64 -64
- data/lib/xqsr3/string_utilities/nil_if_empty.rb +33 -34
- data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +35 -35
- data/lib/xqsr3/string_utilities/quote_if.rb +55 -56
- data/lib/xqsr3/string_utilities/starts_with.rb +64 -64
- data/lib/xqsr3/string_utilities/to_symbol.rb +80 -80
- data/lib/xqsr3/string_utilities/truncate.rb +60 -61
- data/lib/xqsr3/string_utilities.rb +8 -8
- data/lib/xqsr3/version.rb +19 -20
- data/test/performance/frequency_map.rb +13 -27
- data/test/scratch/test_assert_raise_with_message.rb +12 -13
- data/test/unit/array_utilities/tc_join_with_or.rb +140 -142
- data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
- data/test/unit/containers/tc_frequency_map.rb +607 -554
- data/test/unit/containers/tc_multi_map.rb +573 -522
- data/test/unit/conversion/tc_integer_parser.rb +73 -73
- data/test/unit/conversion/tc_to_bool.rb +26 -26
- data/test/unit/diagnostics/exceptions/tc_with_cause.rb +165 -165
- data/test/unit/diagnostics/tc_exception_utilities.rb +156 -156
- data/test/unit/extensions/enumerable/tc_collect_with_index.rb +14 -14
- data/test/unit/extensions/enumerable/tc_detect_map.rb +20 -20
- data/test/unit/extensions/enumerable/tc_unique.rb +34 -34
- data/test/unit/extensions/hash/tc_deep_transform.rb +22 -22
- data/test/unit/extensions/hash/tc_except.rb +28 -28
- data/test/unit/extensions/hash/tc_hash.rb +1 -1
- data/test/unit/extensions/hash/tc_slice.rb +14 -14
- data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
- data/test/unit/extensions/integer/ts_all.rb +12 -0
- data/test/unit/extensions/io/tc_writelines.rb +77 -77
- data/test/unit/extensions/kernel/tc_integer.rb +75 -75
- data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
- data/test/unit/extensions/object/tc_inspect.rb +51 -51
- data/test/unit/extensions/string/tc_bool.tb +24 -24
- data/test/unit/extensions/string/tc_ends_with.rb +53 -53
- data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
- data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
- data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
- data/test/unit/extensions/string/tc_quote_if.rb +18 -18
- data/test/unit/extensions/string/tc_starts_with.rb +53 -53
- data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
- data/test/unit/extensions/string/tc_truncate.rb +18 -18
- data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
- data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
- data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
- data/test/unit/hash_utilities/tc_has_match.rb +70 -70
- data/test/unit/hash_utilities/tc_match.rb +83 -83
- data/test/unit/io/tc_writelines.rb +106 -108
- data/test/unit/quality/tc_parameter_checking.rb +390 -390
- data/test/unit/string_utilities/tc_truncate.rb +28 -28
- data/test/unit/tc_version.rb +15 -15
- metadata +6 -2
@@ -4,62 +4,60 @@ module Unit
|
|
4
4
|
|
5
5
|
module Assertions
|
6
6
|
|
7
|
-
|
7
|
+
unless respond_to? :assert_type_has_instance_methods
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
# Fails unless the given +type+ responds to all of the messages
|
10
|
+
# given by +message_spec+
|
11
|
+
#
|
12
|
+
# === Signature
|
13
|
+
#
|
14
|
+
# * *Parameters:*
|
15
|
+
# - +type+ (::Class) The type
|
16
|
+
# - +message_spec+ (::Symbol, ::Array, ::Hash) A specification of message(s) received by the instances of +type+. If a ::Symbol, then instances must respond to this single message. If an ::Array (all elements of which must be ::Symbol), then instances must respond to _all_ messages. If a ::Hash, then instances must respond to _all_ messages represented by the keys; the values are available for specifying a custom failure message (or value is +nil+ for stock message)
|
17
|
+
# - +failure_message+ (::String) If specified, is used when instances of +type+ do not respond to a message and no custom failure message is provided for it
|
18
|
+
def assert_type_has_instance_methods(type, message_spec, failure_message = nil)
|
19
19
|
|
20
|
-
|
20
|
+
warn "type parameter - '#{type} (#{type.class})' - should be a Class" unless type.is_a?(::Class)
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
case message_spec
|
23
|
+
when ::Hash
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
warn "every key in a Hash message_spec should be of type Symbol" unless message_spec.keys.all? { |k| ::Symbol === k }
|
26
|
+
when ::Array
|
27
27
|
|
28
|
-
|
28
|
+
warn "every key in an Array message_spec should be of type Symbol" unless message_spec.all? { |k| ::Symbol === k }
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
message_spec = Hash[message_spec.map { |s| [ s, nil ] }]
|
31
|
+
when ::Symbol
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
message_spec[message_spec] = nil
|
34
|
+
else
|
35
35
|
|
36
|
-
|
36
|
+
msg = "message_spec - '#{message_spec} (#{message_spec.class})' - should be a Symbol, an Array of Symbols, or a Hash of Symbol => message"
|
37
37
|
|
38
|
-
|
38
|
+
warn msg
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
return assert false, msg
|
41
|
+
end
|
42
42
|
|
43
|
-
|
43
|
+
ims = type.instance_methods
|
44
44
|
|
45
|
-
|
45
|
+
message_spec.each do |sym, message|
|
46
46
|
|
47
|
-
|
47
|
+
unless ims.include? sym
|
48
48
|
|
49
|
-
|
50
|
-
|
49
|
+
message ||= failure_message
|
50
|
+
message ||= "type #{type} does not contain the instance method #{sym}"
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
return assert false, message
|
53
|
+
end
|
54
|
+
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
assert true
|
57
|
+
end
|
58
|
+
end
|
59
59
|
|
60
60
|
end # class Assertions
|
61
61
|
end # module Unit
|
62
62
|
end # module Test
|
63
63
|
|
64
|
-
|
65
|
-
|
data/lib/xqsr3/extensions.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
2
|
# ######################################################################## #
|
3
|
-
# File:
|
3
|
+
# File: lib/xqsr3/hash_utilities/deep_transform.rb
|
4
4
|
#
|
5
|
-
# Purpose:
|
6
|
-
# module
|
5
|
+
# Purpose: Definition of the ::Xqsr3::HashUtilities::DeepTransform module
|
7
6
|
#
|
8
|
-
# Created:
|
9
|
-
# Updated:
|
7
|
+
# Created: 3rd June 2017
|
8
|
+
# Updated: 29th March 2024
|
10
9
|
#
|
11
|
-
# Home:
|
10
|
+
# Home: http://github.com/synesissoftware/xqsr3
|
12
11
|
#
|
13
|
-
# Author:
|
12
|
+
# Author: Matthew Wilson
|
14
13
|
#
|
15
|
-
# Copyright (c)
|
14
|
+
# Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
|
15
|
+
# Copyright (c) 2017-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
18
18
|
# Redistribution and use in source and binary forms, with or without
|
@@ -26,7 +26,7 @@
|
|
26
26
|
# notice, this list of conditions and the following disclaimer in the
|
27
27
|
# documentation and/or other materials provided with the distribution.
|
28
28
|
#
|
29
|
-
# * Neither the names of the copyright
|
29
|
+
# * Neither the names of the copyright holders nor the names of its
|
30
30
|
# contributors may be used to endorse or promote products derived from
|
31
31
|
# this software without specific prior written permission.
|
32
32
|
#
|
@@ -58,94 +58,94 @@ module HashUtilities
|
|
58
58
|
|
59
59
|
module DeepTransform
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
private
|
62
|
+
def self.do_deep_transform_on_hashlike_ h, &block # :nodoc:
|
63
63
|
|
64
|
-
|
64
|
+
::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :map ]
|
65
65
|
|
66
|
-
|
67
|
-
|
66
|
+
case block.arity
|
67
|
+
when 1
|
68
68
|
|
69
|
-
|
70
|
-
|
69
|
+
h =
|
70
|
+
Hash[h.map do |k, v|
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
k = k.deep_transform(&block) if ::Hash === k
|
73
|
+
v = v.deep_transform(&block) if ::Hash === v
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
[yield(k), v]
|
76
|
+
end]
|
77
|
+
when 2
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
h =
|
80
|
+
Hash[h.map do |k, v|
|
81
81
|
|
82
|
-
|
83
|
-
|
82
|
+
k = k.deep_transform(&block) if ::Hash === k
|
83
|
+
v = v.deep_transform(&block) if ::Hash === v
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
yield(k, v)
|
86
|
+
end]
|
87
|
+
else
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
raise ArgumentError, "block arity must be 1 or 2"
|
90
|
+
end
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
h
|
93
|
+
end
|
94
94
|
|
95
|
-
|
95
|
+
def do_deep_transform_on_self_ &block # :nodoc:
|
96
96
|
|
97
|
-
|
97
|
+
::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[]=, :delete, :keys ]
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
case block.arity
|
100
|
+
when 1
|
101
101
|
|
102
|
-
|
102
|
+
self.keys.each do |k|
|
103
103
|
|
104
|
-
|
104
|
+
v = self.delete k
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
k = k.deep_transform(&block) if ::Hash === k
|
107
|
+
v = v.deep_transform(&block) if ::Hash === v
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
self[yield(k)] = v
|
110
|
+
end
|
111
|
+
when 2
|
112
112
|
|
113
|
-
|
113
|
+
self.keys.each do |k|
|
114
114
|
|
115
|
-
|
115
|
+
v = self.delete k
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
k = k.deep_transform(&block) if ::Hash === k
|
118
|
+
v = v.deep_transform(&block) if ::Hash === v
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
k, v = yield(k, v)
|
121
|
+
end
|
122
|
+
else
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
124
|
+
raise ArgumentError, "block arity must be 1 or 2"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
public
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
# Executes the given mandatory 1- or 2-parameter block on the receiving
|
130
|
+
# instance, which must be a Hash or a type that responds to the +map+
|
131
|
+
# message, returning a copy of the instance in which keys (1-parameter
|
132
|
+
# block) or keys and values (2-parameter block) are transformed.
|
133
|
+
def deep_transform &block
|
134
134
|
|
135
|
-
|
136
|
-
|
135
|
+
DeepTransform.do_deep_transform_on_hashlike_(self, &block)
|
136
|
+
end
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
138
|
+
# Executes the given mandatory 1- or 2-parameter block on the receiving
|
139
|
+
# instance, whihc must be a Hash or a type that responds to +[]+,
|
140
|
+
# +delete+, and +keys+ messages, changing the keys (1-parameter block)
|
141
|
+
# or keys and values (2-parameter block).
|
142
|
+
#
|
143
|
+
# @note This method is not strongly exception-safe - failure during
|
144
|
+
# transformation can result in a partially transformed instance
|
145
|
+
def deep_transform! &block
|
146
146
|
|
147
|
-
|
148
|
-
|
147
|
+
do_deep_transform_on_self_(&block)
|
148
|
+
end
|
149
149
|
|
150
150
|
end # module DeepTransform
|
151
151
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
2
|
# ######################################################################## #
|
3
|
-
# File:
|
3
|
+
# File: lib/xqsr3/hash_utilities/key_matching.rb
|
4
4
|
#
|
5
|
-
# Purpose:
|
6
|
-
# module
|
5
|
+
# Purpose: Definition of the ::Xqsr3::HashUtilities::KeyMatching module
|
7
6
|
#
|
8
|
-
# Created:
|
9
|
-
# Updated:
|
7
|
+
# Created: 15th November 2017
|
8
|
+
# Updated: 29th March 2024
|
10
9
|
#
|
11
|
-
# Home:
|
10
|
+
# Home: http://github.com/synesissoftware/xqsr3
|
12
11
|
#
|
13
|
-
# Author:
|
12
|
+
# Author: Matthew Wilson
|
14
13
|
#
|
14
|
+
# Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
|
15
15
|
# Copyright (c) 2017-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -26,7 +26,7 @@
|
|
26
26
|
# notice, this list of conditions and the following disclaimer in the
|
27
27
|
# documentation and/or other materials provided with the distribution.
|
28
28
|
#
|
29
|
-
# * Neither the names of the copyright
|
29
|
+
# * Neither the names of the copyright holders nor the names of its
|
30
30
|
# contributors may be used to endorse or promote products derived from
|
31
31
|
# this software without specific prior written permission.
|
32
32
|
#
|
@@ -60,113 +60,113 @@ module HashUtilities
|
|
60
60
|
# and #match methods
|
61
61
|
module KeyMatching
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
private
|
64
|
+
def self.do_match_ h, re, **options # :nodoc:
|
65
65
|
|
66
|
-
|
66
|
+
::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
|
67
67
|
|
68
|
-
|
68
|
+
return h[re] if h.has_key? re
|
69
69
|
|
70
|
-
|
71
|
-
|
70
|
+
case re
|
71
|
+
when ::Regexp
|
72
72
|
|
73
|
-
|
73
|
+
h.each do |k, v|
|
74
74
|
|
75
|
-
|
76
|
-
|
75
|
+
case k
|
76
|
+
when ::Regexp
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
next
|
79
|
+
else
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
return v if k.to_s =~ re
|
82
|
+
end
|
83
|
+
end
|
84
|
+
else
|
85
85
|
|
86
|
-
|
86
|
+
h.each do |k, v|
|
87
87
|
|
88
|
-
|
89
|
-
|
88
|
+
case k
|
89
|
+
when ::Regexp
|
90
90
|
|
91
|
-
|
92
|
-
|
91
|
+
return v if re.to_s =~ k
|
92
|
+
else
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
next
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
98
|
|
99
|
-
|
100
|
-
|
99
|
+
nil
|
100
|
+
end
|
101
101
|
|
102
|
-
|
102
|
+
def self.do_has_match_ h, re, **options # :nodoc:
|
103
103
|
|
104
|
-
|
104
|
+
::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
|
105
105
|
|
106
|
-
|
106
|
+
return true if h.has_key? re
|
107
107
|
|
108
|
-
|
109
|
-
|
108
|
+
case re
|
109
|
+
when ::Regexp
|
110
110
|
|
111
|
-
|
111
|
+
h.each do |k, v|
|
112
112
|
|
113
|
-
|
114
|
-
|
113
|
+
case k
|
114
|
+
when ::Regexp
|
115
115
|
|
116
|
-
|
117
|
-
|
116
|
+
next
|
117
|
+
else
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
return true if k.to_s =~ re
|
120
|
+
end
|
121
|
+
end
|
122
|
+
else
|
123
123
|
|
124
|
-
|
124
|
+
h.each do |k, v|
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
case k
|
127
|
+
when ::Regexp
|
128
128
|
|
129
|
-
|
130
|
-
|
129
|
+
return true if re.to_s =~ k
|
130
|
+
else
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
next
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
136
|
|
137
|
-
|
138
|
-
|
139
|
-
|
137
|
+
false
|
138
|
+
end
|
139
|
+
public
|
140
140
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
141
|
+
# Retrieves the value object corresponding to the first key object that
|
142
|
+
# matches the given +re+, in the hash +h+, according to the given
|
143
|
+
# options.
|
144
|
+
def self.match h, re, **options
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
|
147
|
+
end
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
# Returns true if the hash +h+ contains a key object that matches the
|
150
|
+
# given +re+, according to the given options
|
151
|
+
def self.has_match? h, re, **options
|
152
152
|
|
153
|
-
|
154
|
-
|
153
|
+
Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
|
154
|
+
end
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
156
|
+
# Retrieves the value object corresponding to the first key object that
|
157
|
+
# matches the given +re+, in the hash +h+, according to the given
|
158
|
+
# options.
|
159
|
+
def match h, re, **options
|
160
160
|
|
161
|
-
|
162
|
-
|
161
|
+
Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
|
162
|
+
end
|
163
163
|
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
# Returns true if the hash +h+ contains a key object that matches the
|
165
|
+
# given +re+, according to the given options
|
166
|
+
def has_match? h, re, **options
|
167
167
|
|
168
|
-
|
169
|
-
|
168
|
+
Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
|
169
|
+
end
|
170
170
|
|
171
171
|
end # module KeyMatching
|
172
172
|
|
data/lib/xqsr3/hash_utilities.rb
CHANGED