xqsr3 0.38.2 → 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 +12 -12
- data/examples/count_word_frequencies.rb +4 -4
- data/lib/xqsr3/array_utilities/join_with_or.rb +47 -47
- data/lib/xqsr3/array_utilities.rb +2 -2
- data/lib/xqsr3/command_line_utilities/map_option_string.rb +60 -60
- data/lib/xqsr3/command_line_utilities.rb +2 -2
- data/lib/xqsr3/containers/frequency_map.rb +399 -399
- data/lib/xqsr3/containers/multi_map.rb +448 -448
- data/lib/xqsr3/containers.rb +3 -3
- data/lib/xqsr3/conversion/bool_parser.rb +51 -51
- data/lib/xqsr3/conversion/integer_parser.rb +87 -87
- data/lib/xqsr3/conversion.rb +3 -3
- data/lib/xqsr3/diagnostics/exception_utilities.rb +145 -145
- data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +90 -90
- data/lib/xqsr3/diagnostics/inspect_builder.rb +80 -80
- data/lib/xqsr3/diagnostics.rb +3 -3
- data/lib/xqsr3/doc_.rb +130 -130
- data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
- data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +12 -12
- data/lib/xqsr3/extensions/enumerable/detect_map.rb +35 -35
- data/lib/xqsr3/extensions/enumerable/unique.rb +29 -28
- 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 +28 -28
- data/lib/xqsr3/extensions/kernel/integer.rb +20 -20
- data/lib/xqsr3/extensions/kernel/raise_with_options.rb +8 -8
- 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 -4
- 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 -1
- data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
- data/lib/xqsr3/extensions/string/to_bool.rb +8 -8
- data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
- data/lib/xqsr3/extensions/string/truncate.rb +1 -1
- data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -6
- data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -6
- data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -61
- data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -7
- data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -6
- data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -36
- data/lib/xqsr3/extensions.rb +5 -5
- data/lib/xqsr3/hash_utilities/deep_transform.rb +65 -65
- data/lib/xqsr3/hash_utilities/key_matching.rb +77 -77
- data/lib/xqsr3/hash_utilities.rb +3 -3
- data/lib/xqsr3/internal_/test_unit_version_.rb +85 -85
- data/lib/xqsr3/io/writelines.rb +119 -119
- data/lib/xqsr3/quality/parameter_checking.rb +445 -445
- data/lib/xqsr3/quality.rb +2 -2
- data/lib/xqsr3/string_utilities/ends_with.rb +59 -59
- data/lib/xqsr3/string_utilities/nil_if_empty.rb +28 -28
- data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +29 -29
- data/lib/xqsr3/string_utilities/quote_if.rb +50 -50
- data/lib/xqsr3/string_utilities/starts_with.rb +59 -59
- data/lib/xqsr3/string_utilities/to_symbol.rb +75 -75
- data/lib/xqsr3/string_utilities/truncate.rb +55 -55
- data/lib/xqsr3/string_utilities.rb +8 -8
- data/lib/xqsr3/version.rb +12 -12
- data/test/performance/frequency_map.rb +12 -12
- data/test/scratch/test_assert_raise_with_message.rb +11 -11
- data/test/unit/array_utilities/tc_join_with_or.rb +140 -140
- data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
- data/test/unit/containers/tc_frequency_map.rb +591 -591
- data/test/unit/containers/tc_multi_map.rb +558 -558
- data/test/unit/conversion/tc_integer_parser.rb +72 -72
- data/test/unit/conversion/tc_to_bool.rb +25 -25
- 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_slice.rb +13 -13
- 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 +50 -50
- 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 -106
- data/test/unit/quality/tc_parameter_checking.rb +389 -389
- data/test/unit/string_utilities/tc_truncate.rb +27 -27
- data/test/unit/tc_version.rb +15 -15
- metadata +6 -2
@@ -5,13 +5,13 @@
|
|
5
5
|
# Purpose: ::Xqsr3::Diagnostics::InspectBuilder module
|
6
6
|
#
|
7
7
|
# Created: 4th September 2018
|
8
|
-
# Updated:
|
8
|
+
# Updated: 29th March 2024
|
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-2024, Matthew Wilson and Synesis Information Systems
|
15
15
|
# Copyright (c) 2018-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -55,117 +55,117 @@ module Diagnostics
|
|
55
55
|
|
56
56
|
module InspectBuilder
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
# @!visibility private
|
59
|
+
module InspectBuilder_Utilities # :nodoc: all
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
# @!visibility private
|
62
|
+
NORMALISE_FUNCTION = lambda { |ar| ar.map { |v| v.to_s }.map { |v| '@' == v[0] ? v : "@#{v}" } }
|
63
|
+
end # module InspectBuilder_Utilities
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
65
|
+
# Generates an inspect string for the +include+-ing class
|
66
|
+
#
|
67
|
+
# === Signature
|
68
|
+
#
|
69
|
+
# * *Parameters:*
|
70
|
+
# - +o+ The target of the +inspect+ message for which a message will be built
|
71
|
+
#
|
72
|
+
# * *Options:*
|
73
|
+
# - +:no_class+ (boolean) Elides the class qualification
|
74
|
+
# - +:no_object_id+ (boolean) Elides the object id
|
75
|
+
# - +:show_fields+ (boolean) Shows (all) object fields
|
76
|
+
# - +:hidden_fields+ ([ String ]) Names of fields to be omitted (when +:show_fields+ is specified). Overridden by +:shown_fields+
|
77
|
+
# - +:shown_fields+ ([ String ]) Names of fields to be shown (when +:show_fields+ is specified). Overrides +:hidden_fields+
|
78
|
+
# - +:truncate_width+ (Integer) Specifies a maximum width for the values of fields
|
79
|
+
# - +:deep_inspect+ (boolean) Causes fields' values to be obtained via their own +inspect+ methods
|
80
|
+
def self.make_inspect o, **options
|
81
81
|
|
82
|
-
|
82
|
+
r = ''
|
83
83
|
|
84
|
-
|
84
|
+
unless options[:no_class]
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
r += o.class.to_s
|
87
|
+
end
|
88
88
|
|
89
|
-
|
89
|
+
unless options[:no_object_id]
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
r += ':' unless r.empty?
|
92
|
+
r += "0x#{o.object_id.to_s.rjust(16, '0')}"
|
93
|
+
end
|
94
94
|
|
95
|
-
|
95
|
+
if options[:show_fields]
|
96
96
|
|
97
|
-
|
97
|
+
normalise = InspectBuilder_Utilities::NORMALISE_FUNCTION
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
hide_fields = normalise.call(options[:hidden_fields] || [])
|
100
|
+
show_fields = normalise.call(options[:shown_fields] || [])
|
101
|
+
trunc_w = options[:truncate_width]
|
102
|
+
ivars = normalise.call(o.instance_variables)
|
103
103
|
|
104
|
-
|
104
|
+
unless show_fields.empty?
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
ivars = ivars & show_fields
|
107
|
+
else
|
108
108
|
|
109
|
-
|
109
|
+
o.class.ancestors.each do |ancestor|
|
110
110
|
|
111
|
-
|
111
|
+
ihf_constant = :INSPECT_HIDDEN_FIELDS
|
112
112
|
|
113
|
-
|
113
|
+
if ancestor.const_defined? ihf_constant
|
114
114
|
|
115
|
-
|
115
|
+
ihfs = ancestor.const_get ihf_constant
|
116
116
|
|
117
|
-
|
117
|
+
if ::Array === ihfs && ihfs.all? { |c| ::String === c }
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
hide_fields += normalise.call(ihfs)
|
120
|
+
else
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
warn "class/module #{ancestor}'s #{ihf_constant} should be an array of strings"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
126
|
|
127
|
-
|
128
|
-
|
127
|
+
ivars = ivars - hide_fields
|
128
|
+
end
|
129
129
|
|
130
|
-
|
130
|
+
els = ivars.sort.map do |iv_name|
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
iv_value = o.instance_variable_get(iv_name)
|
133
|
+
iv_class = iv_value.class
|
134
|
+
iv_value = ::Xqsr3::StringUtilities::Truncate.string_truncate(iv_value.to_s, trunc_w) if trunc_w
|
135
|
+
if options[:deep_inspect]
|
136
136
|
|
137
|
-
|
138
|
-
|
137
|
+
iv_value = iv_value.inspect
|
138
|
+
else
|
139
139
|
|
140
|
-
|
141
|
-
|
140
|
+
case iv_value
|
141
|
+
when ::Array
|
142
142
|
|
143
143
|
|
144
|
-
|
144
|
+
when ::String
|
145
145
|
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
iv_value = "'#{iv_value}'"
|
147
|
+
end
|
148
|
+
end
|
149
149
|
|
150
|
-
|
151
|
-
|
150
|
+
"#{iv_name}(#{iv_class})=#{iv_value}"
|
151
|
+
end.join('; ')
|
152
152
|
|
153
|
-
|
154
|
-
|
155
|
-
|
153
|
+
r += ': ' unless r.empty?
|
154
|
+
r += els
|
155
|
+
end
|
156
156
|
|
157
|
-
|
157
|
+
r = '#<' + r + '>'
|
158
158
|
|
159
|
-
|
160
|
-
|
159
|
+
r
|
160
|
+
end
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
162
|
+
# Creates an inspect string from self
|
163
|
+
#
|
164
|
+
# see InspectBuilder::make_inspect
|
165
|
+
def make_inspect **options
|
166
166
|
|
167
|
-
|
168
|
-
|
167
|
+
::Xqsr3::Diagnostics::InspectBuilder.make_inspect self, **options
|
168
|
+
end
|
169
169
|
|
170
170
|
end # module InspectBuilder
|
171
171
|
|
data/lib/xqsr3/diagnostics.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
%w{
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
exception_utilities
|
5
|
+
inspect_builder
|
6
6
|
}.each do |name|
|
7
7
|
|
8
|
-
|
8
|
+
require File.join(File.dirname(__FILE__), 'diagnostics', name)
|
9
9
|
end
|
10
10
|
|
11
11
|
|
data/lib/xqsr3/doc_.rb
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
# Purpose: Documentation of the ::Xqsr3 modules
|
6
6
|
#
|
7
7
|
# Created: 10th June 2016
|
8
|
-
# Updated:
|
8
|
+
# Updated: 29th March 2024
|
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-2024, Matthew Wilson and Synesis Information Systems
|
15
15
|
# Copyright (c) 2016-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -59,119 +59,119 @@
|
|
59
59
|
# * ::Xqsr3::StringUtilities
|
60
60
|
module Xqsr3
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
62
|
+
# Array utilities
|
63
|
+
#
|
64
|
+
# === Subordinate modules of interest
|
65
|
+
# * ::Xqsr3::ArrayUtilities::JoinWithOr
|
66
|
+
module ArrayUtilities
|
67
|
+
end # module ArrayUtilities
|
68
|
+
|
69
|
+
# Command-line Utilities
|
70
|
+
#
|
71
|
+
# === Subordinate modules of interest
|
72
|
+
# * ::Xqsr3::CommandLineUtilities::MapOptionString
|
73
|
+
module CommandLineUtilities
|
74
|
+
end # module CommandLineUtilities
|
75
|
+
|
76
|
+
# Containers
|
77
|
+
#
|
78
|
+
module Containers
|
79
|
+
end # module Containers
|
80
|
+
|
81
|
+
# Conversion
|
82
|
+
#
|
83
|
+
module Conversion
|
84
|
+
end # module Conversion
|
85
|
+
|
86
|
+
# Diagnostic facilities
|
87
|
+
#
|
88
|
+
# === Subordinate modules of interest
|
89
|
+
# * ::Xqsr3::Diagnostics::ExceptionUtilities
|
90
|
+
# * ::Xqsr3::Diagnostics::InspectBuilder
|
91
|
+
# * ::Xqsr3::Diagnostics::Exceptions::WithCause
|
92
|
+
#
|
93
|
+
module Diagnostics
|
94
|
+
|
95
|
+
# Exception-related utilities
|
96
|
+
#
|
97
|
+
# === Components of interest
|
98
|
+
# * ::Xqsr3::Diagnostics::ExceptionUtilities::raise_with_options
|
99
|
+
#
|
100
|
+
module ExceptionUtilities
|
101
|
+
end # module ExceptionUtilities
|
102
|
+
|
103
|
+
# Inspect builder
|
104
|
+
#
|
105
|
+
module InspectBuilder
|
106
|
+
end # module InspectBuilder
|
107
|
+
|
108
|
+
# Exception-related utilities
|
109
|
+
#
|
110
|
+
# === Components of interest
|
111
|
+
# * ::Xqsr3::Diagnostics::Exceptions::WithCause
|
112
|
+
#
|
113
|
+
module Exceptions
|
114
|
+
end # module Exceptions
|
115
|
+
end # module Diagnostics
|
116
|
+
|
117
|
+
# Hash utilities
|
118
|
+
#
|
119
|
+
# === Subordinate modules of interest
|
120
|
+
# * ::Xqsr3::HashUtilities::DeepTransform
|
121
|
+
# * ::Xqsr3::HashUtilities::KeyMatching
|
122
|
+
module HashUtilities
|
123
|
+
|
124
|
+
# Exception-related utilities
|
125
|
+
#
|
126
|
+
# === Components of interest
|
127
|
+
# * ::Xqsr3::Diagnostics::HashUtilities::deep_transform
|
128
|
+
# * ::Xqsr3::Diagnostics::HashUtilities::deep_transform!
|
129
|
+
#
|
130
|
+
module DeepTransform
|
131
|
+
end # module DeepTransform
|
132
|
+
end # module HashUtilities
|
133
|
+
|
134
|
+
# IO
|
135
|
+
#
|
136
|
+
class IO
|
137
|
+
end # class IO
|
138
|
+
|
139
|
+
# Quality
|
140
|
+
#
|
141
|
+
# === Subordinate modules of interest
|
142
|
+
# * ::Xqsr3::Quality::ParameterChecking
|
143
|
+
module Quality
|
144
|
+
end # module Quality
|
145
|
+
|
146
|
+
# String utilities
|
147
|
+
#
|
148
|
+
# === Subordinate modules of interest
|
149
|
+
# * ::Xqsr3::StringUtilities::EndsWith
|
150
|
+
# * ::Xqsr3::StringUtilities::NilIfEmpty
|
151
|
+
# * ::Xqsr3::StringUtilities::NilIfWhitespace
|
152
|
+
# * ::Xqsr3::StringUtilities::QuoteIf
|
153
|
+
# * ::Xqsr3::StringUtilities::StartsWith
|
154
|
+
# * ::Xqsr3::StringUtilities::ToSymbol
|
155
|
+
# * ::Xqsr3::StringUtilities::Truncate
|
156
|
+
module StringUtilities
|
157
157
|
|
158
158
|
=begin
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
159
|
+
module EndsWith
|
160
|
+
end # module EndsWith
|
161
|
+
module NilIfEmpty
|
162
|
+
end # module NilIfEmpty
|
163
|
+
module NilIfWhitespace
|
164
|
+
end # module NilIfWhitespace
|
165
|
+
module QuoteIf
|
166
|
+
end # module QuoteIf
|
167
|
+
module StartsWith
|
168
|
+
end # module StartsWith
|
169
|
+
module ToSymbol
|
170
|
+
end # module ToSymbol
|
171
|
+
module Truncate
|
172
|
+
end # module Truncate
|
173
173
|
=end
|
174
|
-
|
174
|
+
end # module StringUtilities
|
175
175
|
end # module Xqsr3
|
176
176
|
|
177
177
|
# Standard class, extended with methods:
|
@@ -220,24 +220,24 @@ class String; end
|
|
220
220
|
# Standard module
|
221
221
|
module Test
|
222
222
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
223
|
+
# Standard module
|
224
|
+
module Unit
|
225
|
+
|
226
|
+
# Standard module
|
227
|
+
#
|
228
|
+
# === Components of interest
|
229
|
+
# * ::Test::Unit::Assertions#assert_eql
|
230
|
+
# * ::Test::Unit::Assertions#assert_false
|
231
|
+
# * ::Test::Unit::Assertions#assert_not
|
232
|
+
# * ::Test::Unit::Assertions#assert_not_eql
|
233
|
+
# * ::Test::Unit::Assertions#assert_raise_with_message
|
234
|
+
# * ::Test::Unit::Assertions#assert_subclass_of
|
235
|
+
# * ::Test::Unit::Assertions#assert_superclass_of
|
236
|
+
# * ::Test::Unit::Assertions#assert_true
|
237
|
+
# * ::Test::Unit::Assertions#assert_type_has_instance_methods
|
238
|
+
module Assertions
|
239
|
+
end # module Assertions
|
240
|
+
end # module Unit
|
241
241
|
end # module Test
|
242
242
|
|
243
243
|
|
@@ -3,16 +3,16 @@ require 'xqsr3/array_utilities/join_with_or'
|
|
3
3
|
|
4
4
|
class Array
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
# Extended method implemented by JoinWithOr
|
7
|
+
#
|
8
|
+
# === Signature
|
9
|
+
#
|
10
|
+
# * *Parameters:*
|
11
|
+
# - +options+ (Hash) See Xqsr3::ArrayUtilities
|
12
|
+
def join_with_or **options
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
return ::Xqsr3::ArrayUtilities::JoinWithOr.join_with_or self, **options
|
15
|
+
end
|
16
16
|
end
|
17
17
|
|
18
18
|
|
@@ -5,13 +5,13 @@
|
|
5
5
|
# Purpose: Adds a collect_with_index() method to the Enumerable module
|
6
6
|
#
|
7
7
|
# Created: 24th October 2010
|
8
|
-
# Updated:
|
8
|
+
# Updated: 29th March 2024
|
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-2024, Matthew Wilson and Synesis Information Systems
|
15
15
|
# Copyright (c) 2010-2019, Matthew Wilson and Synesis Software
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -53,20 +53,20 @@
|
|
53
53
|
|
54
54
|
module Enumerable
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
# Two-parameter variant of +Enumerable+#+collect+, where the second
|
57
|
+
# parameter is a +base+-based index, which increments by 1 for each
|
58
|
+
# enumerated element.
|
59
|
+
def collect_with_index(base = 0)
|
60
60
|
|
61
|
-
|
61
|
+
a = []
|
62
62
|
|
63
|
-
|
63
|
+
self.each_with_index do |element, index|
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
a.push yield(element, base + index)
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
68
|
+
a
|
69
|
+
end
|
70
70
|
end # module Enumerable
|
71
71
|
|
72
72
|
# ############################## end of file ############################# #
|