xqsr3 0.22.4 → 0.26.4

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: f9ba5e26e05f852e8093d7fad6e1ea1b3aea26e596bac32483b5a0c0ec6176a5
4
- data.tar.gz: 034b29eb4f8ce8ff96bfe05d98adcdca2c255e8f54ae295daafb00bce93ee942
2
+ SHA1:
3
+ metadata.gz: 7ccb3ee0c47865bb1eede2560dacd10988fe5c88
4
+ data.tar.gz: aa200aec397e17b577c201253faed63f4c4f31f6
5
5
  SHA512:
6
- metadata.gz: 634f55ac0143b7285caf59a41b06b96f3bc4aaacaa343dc68fdad6372916de3b8d58f5adf23179948ba5bef665c4da1fe6abe285d51925655ffc920f68aa59a1
7
- data.tar.gz: 90b016538c14a6d7f24e2d3b0e379eacf4b1e33be938ba5f4a7adfa016848d0482d973ab99ae24293c4fecf98839d7c8d799b371f825caef982cd5cb7302086d
6
+ metadata.gz: 318fcaf298a8096a4ff6ad97b9ae6522bc7997c446cde7ad5e12cf25ae0e09cb7b771d38ac900ae680299eb031359bc46d799176ccee22460d02e36adca2276d
7
+ data.tar.gz: 3521b7dd6621c09af7bc43d65b9af27a98fbb32ee32296ce07cdc60ca4950d1e4d5e4f1a4dacec139366a89fd90cdd618194ad6bd019d79d219d405f23b58e4a
@@ -116,3 +116,4 @@ end # module Xqsr3
116
116
 
117
117
  # ############################## end of file ############################# #
118
118
 
119
+
@@ -0,0 +1,193 @@
1
+
2
+ # ######################################################################## #
3
+ # File: lib/xqsr3/conversion/integer_parser.rb
4
+ #
5
+ # Purpose: Definition of the ::Xqsr3::Conversion::IntegerParser
6
+ # module
7
+ #
8
+ # Created: 21st November 2017
9
+ # Updated: 1st August 2018
10
+ #
11
+ # Home: http://github.com/synesissoftware/xqsr3
12
+ #
13
+ # Author: Matthew Wilson
14
+ #
15
+ # Copyright (c) 2017-2018, Matthew Wilson and Synesis Software
16
+ # All rights reserved.
17
+ #
18
+ # Redistribution and use in source and binary forms, with or without
19
+ # modification, are permitted provided that the following conditions are
20
+ # met:
21
+ #
22
+ # * Redistributions of source code must retain the above copyright notice,
23
+ # this list of conditions and the following disclaimer.
24
+ #
25
+ # * Redistributions in binary form must reproduce the above copyright
26
+ # notice, this list of conditions and the following disclaimer in the
27
+ # documentation and/or other materials provided with the distribution.
28
+ #
29
+ # * Neither the names of the copyright holder nor the names of its
30
+ # contributors may be used to endorse or promote products derived from
31
+ # this software without specific prior written permission.
32
+ #
33
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
34
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
35
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
+ #
45
+ # ######################################################################## #
46
+
47
+
48
+ # ##########################################################
49
+ # ::Xqsr3::Conversion::IntegerParser
50
+
51
+ =begin
52
+ =end
53
+
54
+ module Xqsr3
55
+ module Conversion
56
+
57
+ module IntegerParser
58
+
59
+ private
60
+ module IntegerParser_Helper_ # :nodoc:
61
+
62
+ if Kernel.respond_to?(:xqsr3_Integer_original_method)
63
+
64
+ def self.invoke_Integer_1(arg)
65
+
66
+ Kernel.xqsr3_Integer_original_method(arg)
67
+ end
68
+
69
+ def self.invoke_Integer_2(arg, base)
70
+
71
+ Kernel.xqsr3_Integer_original_method(arg, base)
72
+ end
73
+ else
74
+
75
+ def self.invoke_Integer_1(arg)
76
+
77
+ Kernel.Integer(arg)
78
+ end
79
+
80
+ def self.invoke_Integer_2(arg, base)
81
+
82
+ Kernel.Integer(arg, base)
83
+ end
84
+ end
85
+
86
+ def self.invoke_Integer(arg, base)
87
+
88
+ case arg
89
+ when ::String
90
+
91
+ self.invoke_Integer_2 arg, base
92
+ else
93
+
94
+ if $DEBUG
95
+
96
+ case base
97
+ when nil, 0
98
+
99
+ ;
100
+ else
101
+
102
+ warn "WARNING: #{self}::#{__method__}: " + 'base specified for non string value'
103
+ end
104
+ end
105
+
106
+ self.invoke_Integer_1 arg
107
+ end
108
+ end
109
+
110
+ def self.to_integer_ arg, base, options, &block
111
+
112
+ case options
113
+ when ::Hash
114
+ ;
115
+ else
116
+
117
+ raise TypeError, "options must be of type #{::Hash}, #{options.class} given"
118
+ end
119
+
120
+ if block_given?
121
+
122
+ begin
123
+
124
+ return self.invoke_Integer arg, base
125
+ rescue ArgumentError, TypeError => x
126
+
127
+ return yield x, arg, base, options
128
+ end
129
+ end
130
+
131
+ if options.has_key?(:default) || options[:nil]
132
+
133
+ unless arg.nil?
134
+
135
+ begin
136
+
137
+ return self.invoke_Integer arg, base
138
+ rescue ArgumentError, TypeError
139
+ end
140
+ end
141
+
142
+ return options[:default] if options.has_key? :default
143
+
144
+ return nil
145
+ else
146
+
147
+ self.invoke_Integer arg, base
148
+ end
149
+ end
150
+ end # module IntegerParser_Helper_
151
+ public
152
+
153
+ # Attempts to convert a variable to an integer, according to the given
154
+ # options and block
155
+ #
156
+ # === Signature
157
+ #
158
+ # * *Parameters*:
159
+ # - +arg+:: The argument to be converted (to +Fixnum+ or +Bignum+)
160
+ # - +base+:: A value of 0, or between 2 and 36. Defaults to 0
161
+ # - +options+:: An options hash, containing any of the following
162
+ # options
163
+ # - +block+:: An optional caller-supplied 4-parameter block -
164
+ # taking the exception, +arg+, +base+, and +options+ - that will be
165
+ # invoked with the +ArgumentError+ exception, allowing the caller to
166
+ # take additional action. If the block returns then its return value
167
+ # will be returned to the caller
168
+ #
169
+ # * *Options*:
170
+ # - +:default+:: A default value to be used when +arg+ is +nil+ or
171
+ # cannot be converted by (the original) +Kernel#Integer+
172
+ # - +:nil+:: Returns +nil+ if +arg+ is +nil+ or cannot be
173
+ # converted by (the original) +Kernel#Integer+. Ignored if
174
+ # +:default+ is specified
175
+ def self.to_integer arg, base = 0, **options, &block
176
+
177
+ IntegerParser_Helper_.to_integer_ arg, base, options, &block
178
+ end
179
+
180
+ # Instance form of ::Xqsr3::Conversion::IntegerParser.to_integer
181
+ def to_integer base = 0, **options, &block
182
+
183
+ IntegerParser_Helper_.to_integer_ self, base, options, &block
184
+ end
185
+
186
+ end # module IntegerParser
187
+
188
+ end # module Conversion
189
+ end # module Xqsr3
190
+
191
+ # ############################## end of file ############################# #
192
+
193
+
@@ -5,13 +5,13 @@
5
5
  # Purpose: Definition of the WithCause inclusion module
6
6
  #
7
7
  # Created: 16th December 2017
8
- # Updated: 17th December 2017
8
+ # Updated: 14th March 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2017, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2017-2018, Matthew Wilson and Synesis Software
15
15
  # All rights reserved.
16
16
  #
17
17
  # Redistribution and use in source and binary forms, with or without
@@ -92,7 +92,7 @@ module WithCause
92
92
 
93
93
  @has_implicit_message = args.empty?
94
94
 
95
- super *args
95
+ super(*args)
96
96
 
97
97
  warn 'unexpected implicit message' if @has_implicit_message && self.message != self.class.to_s
98
98
 
@@ -123,7 +123,7 @@ module WithCause
123
123
 
124
124
  @has_implicit_message = args.empty?
125
125
 
126
- super *args
126
+ super(*args)
127
127
 
128
128
  warn 'unexpected implicit message' if @has_implicit_message && self.message != self.class.to_s
129
129
 
@@ -5,13 +5,13 @@
5
5
  # Purpose: Adds a Integer 'overload' to the Kernel module
6
6
  #
7
7
  # Created: 21st November 2017
8
- # Updated: 22nd November 2017
8
+ # Updated: 18th May 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2017, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2017-2018, Matthew Wilson and Synesis Software
15
15
  # All rights reserved.
16
16
  #
17
17
  # Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,8 @@
44
44
  # ######################################################################## #
45
45
 
46
46
 
47
+ require 'xqsr3/conversion/integer_parser'
48
+
47
49
  # ##########################################################
48
50
  # ::Kernel
49
51
 
@@ -62,7 +64,11 @@ module Kernel
62
64
  # - +arg+:: The argument to be converted (to +Fixnum+ or +Bignum+)
63
65
  # - +base+:: A value of 0, or between 2 and 36. Defaults to 0
64
66
  # - +options+:: An options hash, containing any of the following
65
- # options
67
+ # options
68
+ # - +block+:: An optional caller-supplied block that will be invoked
69
+ # with the +ArgumentError+ exception, allowing the caller to take
70
+ # additional action. If the block returns then its return value will
71
+ # be returned to the caller
66
72
  #
67
73
  # * *Options*:
68
74
  # - +:default+:: A default value to be used when +arg+ is +nil+ or
@@ -70,26 +76,9 @@ module Kernel
70
76
  # - +:nil+:: Returns +nil+ if +arg+ is +nil+ or cannot be
71
77
  # converted by (the original) +Kernel#Integer+. Ignored if
72
78
  # +:default+ is specified
73
- def Integer(arg, base = 0, **options)
74
-
75
- if options.has_key?(:default) || options[:nil]
76
-
77
- unless arg.nil?
78
-
79
- begin
80
-
81
- return xqsr3_Integer_original_method arg, base
82
- rescue ArgumentError
83
- end
84
- end
85
-
86
- return options[:default] if options.has_key? :default
87
-
88
- return nil
89
- else
79
+ def Integer(arg, base = 0, **options, &block)
90
80
 
91
- xqsr3_Integer_original_method arg, base
92
- end
81
+ ::Xqsr3::Conversion::IntegerParser.to_integer arg, base = 0, **options, &block
93
82
  end
94
83
 
95
84
  private :xqsr3_Integer_original_method
@@ -5,4 +5,5 @@ require 'xqsr3/extensions/string/quote_if'
5
5
  require 'xqsr3/extensions/string/starts_with'
6
6
  require 'xqsr3/extensions/string/to_bool'
7
7
  require 'xqsr3/extensions/string/to_symbol'
8
+ require 'xqsr3/extensions/string/truncate'
8
9
 
@@ -0,0 +1,9 @@
1
+
2
+ require 'xqsr3/string_utilities/truncate'
3
+
4
+ class String
5
+
6
+ include ::Xqsr3::StringUtilities::Truncate
7
+ end # class String
8
+
9
+
@@ -40,12 +40,15 @@ module Assertions
40
40
 
41
41
  yield
42
42
 
43
- assert false, "expected did not throw an exception"
43
+ assert false, 'the block did not throw an exception as was expected'
44
+ rescue Test::Unit::AssertionFailedError
45
+
46
+ raise
44
47
  rescue Exception => x
45
48
 
46
49
  if type_spec
47
50
 
48
- assert false, "exception not of any of required types (#{type_spec.join(', ')}); #{x.class} given" unless type_spec.any? { |c| x.is_a? c}
51
+ assert false, "exception (#{x.class}) - message: '#{x.message}' - not of any of required types (#{type_spec.join(', ')}); #{x.class} given" unless type_spec.any? { |c| x.is_a? c}
49
52
  end
50
53
 
51
54
  if message_spec
@@ -6,13 +6,13 @@
6
6
  # module
7
7
  #
8
8
  # Created: 3rd June 2017
9
- # Updated: 28th July 2017
9
+ # Updated: 14th March 2018
10
10
  #
11
11
  # Home: http://github.com/synesissoftware/xqsr3
12
12
  #
13
13
  # Author: Matthew Wilson
14
14
  #
15
- # Copyright (c) 2017, Matthew Wilson and Synesis Software
15
+ # Copyright (c) 2017-2018, 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
@@ -45,6 +45,8 @@
45
45
  # ######################################################################## #
46
46
 
47
47
 
48
+ require 'xqsr3/quality/parameter_checking'
49
+
48
50
  # ##########################################################
49
51
  # ::Xqsr3::HashUtilities::DeepTransform
50
52
 
@@ -5,7 +5,7 @@
5
5
  # Purpose: Definition of the ParameterChecking module
6
6
  #
7
7
  # Created: 12th February 2015
8
- # Updated: 2nd January 2018
8
+ # Updated: 29th July 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -75,6 +75,26 @@ module ParameterChecking
75
75
  "#{a[0...-1].join(', ')}, or #{a[-1]}"
76
76
  end
77
77
  end
78
+
79
+ module Constants
80
+
81
+ RECOGNISED_OPTION_NAMES = %w{
82
+
83
+ allow_nil
84
+ nil
85
+ types
86
+ type
87
+ values
88
+ responds_to
89
+ reject_empty
90
+ require_empty
91
+ nothrow
92
+ message
93
+ strip_str_whitespace
94
+ treat_as_option
95
+ }.map { |v| v.to_sym }
96
+
97
+ end # module Constants
78
98
  end # module Util_
79
99
  public
80
100
 
@@ -86,34 +106,38 @@ module ParameterChecking
86
106
  private
87
107
  # Check a given parameter (value=+value+, name=+name+) for type and value
88
108
  #
89
- # @param +value+ the parameter whose value and type is to be checked
90
- # @param +name+ [::String, ::Symbol] the name of the parameter to be
109
+ # @param +value+:: the parameter whose value and type is to be checked
110
+ # @param +name+:: (::String, ::Symbol) the name of the parameter to be
91
111
  # checked
92
- # @param +options+ [::Hash] options that moderate the behaviour
112
+ # @param +options+:: (::Hash) options that moderate the behaviour
93
113
  #
94
- # @option +:allow_nil+ [boolean] The +value+ must not be +nil+ unless
114
+ # @option +:allow_nil+:: (boolean) The +value+ must not be +nil+ unless
95
115
  # this option is true
96
- # @option +:nil+ an alias for +:allow_nil+
97
- # @option +:types+ [::Array] An array of types one of which +value+ must
98
- # be (or must be derived from). One of these types may be an
99
- # array of types, in which case +value+ may be an array that
116
+ # @option +:nil+:: an alias for +:allow_nil+
117
+ # @option +:types+:: (::Array) An array of types one of which +value+
118
+ # must be (or must be derived from). One of these types may be
119
+ # an array of types, in which case +value+ may be an array that
100
120
  # must consist wholly of those types
101
- # @option +:type+ [::Class] A single type parameter, used only if
121
+ # @option +:type+:: (::Class) A single type parameter, used only if
102
122
  # +:types+ is not specified
103
- # @option +:values+ [::Array] an array of values one of which +value+
123
+ # @option +:values+:: (::Array) an array of values one of which +value+
104
124
  # must be
105
- # @option +:responds_to+ [::Array] An array of symbols specifying all
125
+ # @option +:responds_to+:: (::Array) An array of symbols specifying all
106
126
  # messages to which the parameter will respond
107
- # @option +:reject_empty+ [boolean] requires value to respond to +empty?+
108
- # message and to do so with false, unless +nil+
109
- # @option +:require_empty+ [boolean] requires value to respond to
127
+ # @option +:reject_empty+:: (boolean) requires value to respond to
128
+ # +empty?+ message and to do so with false, unless +nil+
129
+ # @option +:require_empty+:: (boolean) requires value to respond to
110
130
  # +empty?+ message and to do so with true, unless +nil+
111
- # @option +:nothrow+ [boolean] causes failure to be indicated by a +nil+
112
- # return rather than a thrown exception
113
- # @option +:message+ [::String] specifies a message to be used in any
131
+ # @option +:nothrow+:: (boolean) causes failure to be indicated by a
132
+ # +nil+ return rather than a thrown exception
133
+ # @option +:message+:: (::String) specifies a message to be used in any
114
134
  # thrown exception, which suppresses internal message
115
135
  # preparation
116
- # @option +:treat_as_option+ [boolean] If true, the value will be
136
+ # @option +:strip_str_whitespace+:: (boolean) If +value+ is a string (as
137
+ # determined by responding to +to_str+ message), then it will
138
+ # be stripped - leading and trailing whitespace removed -
139
+ # before any processing
140
+ # @option +:treat_as_option+:: (boolean) If true, the value will be
117
141
  # treated as an option when reporting check failure
118
142
  #
119
143
  # This method is private, because it should only be used within methods
@@ -134,51 +158,50 @@ module ParameterChecking
134
158
  # Specific form of the +check_parameter()+ that is used to check
135
159
  # options, taking instead the hash and the key
136
160
  #
137
- # @param +h+ [::Hash] The options hash from which the named element is
161
+ # @param +h+:: (::Hash) The options hash from which the named element is
138
162
  # to be tested. May not be +nil+
139
- # @param +name+ [::String, ::Symbol] The options key name. May not be
140
- # +nil+
141
- # @param +options+ [::Hash] options that moderate the behaviour in the
163
+ # @param +name+:: (::String, ::Symbol, [ ::String, ::Symbol ]) The
164
+ # options key name, or an array of names. May not be +nil+
165
+ # @param +options+:: (::Hash) options that moderate the behaviour in the
142
166
  # same way as for +check_parameter()+ except that the
143
167
  # +:treat_as_option+ option (with the value +true+) is merged in
144
168
  # before calling +check_parameter()+
145
169
  #
146
- #
147
170
  def check_option h, name, options = {}, &block
148
171
 
149
- Util_.check_parameter h[name], name, options.merge({ treat_as_option: true }), &block
172
+ Util_.check_option h, name, options, &block
150
173
  end
151
174
 
152
175
  public
153
176
  # Check a given parameter (value=+value+, name=+name+) for type and value
154
177
  #
155
- # @param +value+ the parameter whose value and type is to be checked
156
- # @param +name+ the name of the parameter to be checked
157
- # @param +options+ options
178
+ # @param +value+:: the parameter whose value and type is to be checked
179
+ # @param +name+:: the name of the parameter to be checked
180
+ # @param +options+:: options
158
181
  #
159
- # @option +:allow_nil+ [boolean] The +value+ must not be +nil+ unless
182
+ # @option +:allow_nil+:: (boolean) The +value+ must not be +nil+ unless
160
183
  # this option is true
161
- # @option +:nil+ an alias for +:allow_nil+
162
- # @option +:types+ [::Array] An array of types one of which +value+ must
184
+ # @option +:nil+:: an alias for +:allow_nil+
185
+ # @option +:types+:: (::Array) An array of types one of which +value+ must
163
186
  # be (or must be derived from). One of these types may be an
164
187
  # array of types, in which case +value+ may be an array that
165
188
  # must consist wholly of those types
166
- # @option +:type+ [::Class] A single type parameter, used only if
189
+ # @option +:type+:: (::Class) A single type parameter, used only if
167
190
  # +:types+ is not specified
168
- # @option +:values+ [::Array] an array of values one of which +value+
191
+ # @option +:values+:: (::Array) an array of values one of which +value+
169
192
  # must be
170
- # @option +:responds_to+ [::Array] An array of symbols specifying all
193
+ # @option +:responds_to+:: (::Array) An array of symbols specifying all
171
194
  # messages to which the parameter will respond
172
- # @option +:reject_empty+ [boolean] requires value to respond to +empty?+
195
+ # @option +:reject_empty+:: (boolean) requires value to respond to +empty?+
173
196
  # message and to do so with false, unless +nil+
174
- # @option +:require_empty+ [boolean] requires value to respond to
197
+ # @option +:require_empty+:: (boolean) requires value to respond to
175
198
  # +empty?+ message and to do so with true, unless +nil+
176
- # @option +:nothrow+ [boolean] causes failure to be indicated by a +nil+
199
+ # @option +:nothrow+:: (boolean) causes failure to be indicated by a +nil+
177
200
  # return rather than a thrown exception
178
- # @option +:message+ [boolean] specifies a message to be used in any
201
+ # @option +:message+:: (boolean) specifies a message to be used in any
179
202
  # thrown exception, which suppresses internal message
180
203
  # preparation
181
- # @option +:treat_as_option+ [boolean] If true, the value will be
204
+ # @option +:treat_as_option+:: (boolean) If true, the value will be
182
205
  # treated as an option when reporting check failure
183
206
  #
184
207
  def self.check_parameter value, name, options = {}, &block
@@ -196,14 +219,74 @@ module ParameterChecking
196
219
  end
197
220
 
198
221
  private
222
+ def Util_.check_option h, names, options = {}, &block
223
+
224
+ warn "#{self}::#{__method__}: given parameter h - value '#{h.inspect}' - must be a #{::Hash} but is a #{h.class}" unless ::Hash === h
225
+
226
+ case names
227
+ when ::Array
228
+
229
+ allow_nil = options[:allow_nil] || options[:nil]
230
+
231
+ # find the first item whose name is in the hash ...
232
+
233
+ found_name = names.find { |name| h.has_key?(name) }
234
+
235
+ if found_name.nil? && allow_nil
236
+
237
+ return nil
238
+ end
239
+
240
+ # ... or use the first (just to get a name for reporting)
241
+
242
+ found_name ||= names[0]
243
+
244
+ Util_.check_parameter h[found_name], found_name, options.merge({ treat_as_option: true }), &block
245
+ else
246
+
247
+ name = names
248
+
249
+ Util_.check_parameter h[name], name, options.merge({ treat_as_option: true }), &block
250
+ end
251
+ end
252
+
199
253
  def Util_.check_parameter value, name, options, &block
200
254
 
255
+ if $DEBUG
256
+
257
+ unrecognised_option_names = options.keys - Util_::Constants::RECOGNISED_OPTION_NAMES
258
+
259
+ unless unrecognised_option_names.empty?
260
+
261
+ s = "#{self}::check_parameter: the following options are not recognised:"
262
+
263
+ unrecognised_option_names.each { |n| s += "\n\t'#{n}'" }
264
+
265
+ warn s
266
+ end
267
+ end
268
+
269
+ # strip whitespace
270
+
271
+ if !value.nil? && options[:strip_str_whitespace]
272
+
273
+ if value.respond_to? :to_str
274
+
275
+ value = value.to_str.strip
276
+ else
277
+
278
+ warn "#{self}::#{__method__}: options[:strip_str_whitespace] specified but value - '#{value}' (#{value.class}) - does not respond to to_str" unless value.respond_to? :to_str
279
+ end
280
+ end
281
+
282
+
201
283
  failed_check = false
202
284
  options ||= {}
203
285
  message = options[:message]
204
286
  treat_as_option = options[:treat_as_option]
205
287
  return_value = value
206
288
  param_s = treat_as_option ? 'option' : 'parameter'
289
+ allow_nil = options[:allow_nil] || options[:nil]
207
290
 
208
291
  warn "#{self}::check_parameter: invoked with non-string/non-symbol name: name.class=#{name.class}" unless name && [ ::String, ::Symbol ].any? { |c| name.is_a?(c) }
209
292
 
@@ -211,8 +294,10 @@ module ParameterChecking
211
294
 
212
295
  case name
213
296
  when ::String
214
- name = ':' + name if ':' != name[0]
297
+
298
+ ;
215
299
  when ::Symbol
300
+
216
301
  name = ':' + name.to_s
217
302
  else
218
303
  end
@@ -221,7 +306,7 @@ module ParameterChecking
221
306
 
222
307
  # nil check
223
308
 
224
- if value.nil? && !options[:allow_nil]
309
+ if value.nil? && !allow_nil
225
310
 
226
311
  failed_check = true
227
312
 
@@ -256,7 +341,7 @@ module ParameterChecking
256
341
  types = [value.class] if types.empty?
257
342
 
258
343
  warn "#{self}::check_parameter: options[:types] of type #{types.class} - should be #{::Array}" unless types.is_a?(Array)
259
- warn "#{self}::check_parameter: options[:types] - '#{options[:types]}' - should contain only classes or arrays of classes" if types.is_a?(::Array) && !types.all? { |c| ::Class === c || (::Array === c && c.all? { |c2| ::Class === c2 }) }
344
+ warn "#{self}::check_parameter: options[:types] - '#{types}' - should contain only classes or arrays of classes" if types.is_a?(::Array) && !types.all? { |c| ::Class === c || (::Array === c && c.all? { |c2| ::Class === c2 }) }
260
345
 
261
346
  unless types.any? do |t|
262
347
 
@@ -330,44 +415,47 @@ module ParameterChecking
330
415
 
331
416
  # reject/require empty?
332
417
 
333
- if options[:reject_empty]
418
+ unless value.nil?
334
419
 
335
- warn "#{self}::check_parameter: value '#{value}' of type #{value.class} does not respond to empty?" unless value.respond_to? :empty?
420
+ if options[:reject_empty]
336
421
 
337
- if value.empty?
422
+ warn "#{self}::check_parameter: value '#{value}' of type #{value.class} does not respond to empty?" unless value.respond_to? :empty?
338
423
 
339
- failed_check = true
424
+ if value.empty?
340
425
 
341
- unless options[:nothrow]
426
+ failed_check = true
342
427
 
343
- unless message
344
- s_name = name.is_a?(String) ? "'#{name}' " : ''
428
+ unless options[:nothrow]
345
429
 
346
- message = "#{param_s} #{s_name}must not be empty"
347
- end
430
+ unless message
431
+ s_name = name.is_a?(String) ? "'#{name}' " : ''
432
+
433
+ message = "#{param_s} #{s_name}must not be empty"
434
+ end
348
435
 
349
- raise ArgumentError, message
436
+ raise ArgumentError, message
437
+ end
350
438
  end
351
439
  end
352
- end
353
440
 
354
- if options[:require_empty]
441
+ if options[:require_empty]
355
442
 
356
- warn "#{self}::check_parameter: value '#{value}' of type #{value.class} does not respond to empty?" unless value.respond_to? :empty?
443
+ warn "#{self}::check_parameter: value '#{value}' of type #{value.class} does not respond to empty?" unless value.respond_to? :empty?
357
444
 
358
- unless value.empty?
445
+ unless value.empty?
359
446
 
360
- failed_check = true
447
+ failed_check = true
361
448
 
362
- unless options[:nothrow]
449
+ unless options[:nothrow]
363
450
 
364
- unless message
365
- s_name = name.is_a?(String) ? "'#{name}' " : ''
451
+ unless message
452
+ s_name = name.is_a?(String) ? "'#{name}' " : ''
366
453
 
367
- message = "#{param_s} #{s_name}must be empty"
368
- end
454
+ message = "#{param_s} #{s_name}must be empty"
455
+ end
369
456
 
370
- raise ArgumentError, message
457
+ raise ArgumentError, message
458
+ end
371
459
  end
372
460
  end
373
461
  end
@@ -0,0 +1,121 @@
1
+
2
+ # ######################################################################## #
3
+ # File: lib/xqsr3/string_utilities/truncate.rb
4
+ #
5
+ # Purpose: Definition of the ::Xqsr3::StringUtilities::Truncate
6
+ # module
7
+ #
8
+ # Created: 12th April 2018
9
+ # Updated: 12th April 2018
10
+ #
11
+ # Home: http://github.com/synesissoftware/xqsr3
12
+ #
13
+ # Author: Matthew Wilson
14
+ #
15
+ # Copyright (c) 2018, Matthew Wilson and Synesis Software
16
+ # All rights reserved.
17
+ #
18
+ # Redistribution and use in source and binary forms, with or without
19
+ # modification, are permitted provided that the following conditions are
20
+ # met:
21
+ #
22
+ # * Redistributions of source code must retain the above copyright notice,
23
+ # this list of conditions and the following disclaimer.
24
+ #
25
+ # * Redistributions in binary form must reproduce the above copyright
26
+ # notice, this list of conditions and the following disclaimer in the
27
+ # documentation and/or other materials provided with the distribution.
28
+ #
29
+ # * Neither the names of the copyright holder nor the names of its
30
+ # contributors may be used to endorse or promote products derived from
31
+ # this software without specific prior written permission.
32
+ #
33
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
34
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
35
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
37
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
41
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
+ #
45
+ # ######################################################################## #
46
+
47
+
48
+ # ##########################################################
49
+ # ::Xqsr3::StringUtilities::Truncate
50
+
51
+ =begin
52
+ =end
53
+
54
+ module Xqsr3
55
+ module StringUtilities
56
+
57
+ # To-symbol conversion facilities
58
+ #
59
+ module Truncate
60
+
61
+ private
62
+ module Truncate_Helper_ #:nodoc:
63
+
64
+ def self.string_truncate_with_options_ s, width, options
65
+
66
+ case s
67
+ when ::String
68
+ ;
69
+ else
70
+
71
+ if s.respond_to? :to_str
72
+
73
+ s = s.to_str
74
+ else
75
+
76
+ raise TypeError, "string argument must be of type #{::String} or a type that will respond to to_str"
77
+ end
78
+ end
79
+
80
+ case options
81
+ when ::Hash
82
+ ;
83
+ else
84
+
85
+ raise TypeError, "options must be of type #{::Hash}, #{options.class} given"
86
+ end
87
+
88
+ len = s.size
89
+
90
+ return s if len <= width
91
+
92
+ omission = options[:omission] || '...'
93
+
94
+ if width < omission.size
95
+
96
+ return omission[0...width]
97
+ else
98
+
99
+ return s[0...(width - omission.size)] + omission
100
+ end
101
+ end
102
+ end
103
+ public
104
+
105
+ def self.string_truncate s, width, options = {}
106
+
107
+ Truncate_Helper_.string_truncate_with_options_ s, width, options
108
+ end
109
+
110
+ def truncate width, options = {}
111
+
112
+ Truncate_Helper_.string_truncate_with_options_ self, width, options
113
+ end
114
+ end # module Truncate
115
+
116
+ end # module StringUtilities
117
+ end # module Xqsr3
118
+
119
+ # ############################## end of file ############################# #
120
+
121
+
@@ -5,7 +5,7 @@
5
5
  # Purpose: Version for Xqsr3 library
6
6
  #
7
7
  # Created: 3rd April 2016
8
- # Updated: 28th February 2018
8
+ # Updated: 1st August 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -50,7 +50,7 @@
50
50
  module Xqsr3
51
51
 
52
52
  # Current version of the Xqsr3 library
53
- VERSION = '0.22.4'
53
+ VERSION = '0.26.4'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -66,3 +66,4 @@ end # module Xqsr3
66
66
 
67
67
  # ############################## end of file ############################# #
68
68
 
69
+
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../lib')
4
+
5
+ require 'xqsr3/conversion/integer_parser'
6
+
7
+ require 'xqsr3/extensions/test/unit'
8
+
9
+ require 'test/unit'
10
+
11
+ class Test_IntegerParser < Test::Unit::TestCase
12
+
13
+ IP = ::Xqsr3::Conversion::IntegerParser
14
+
15
+ class SomeRandomException < Exception; end
16
+
17
+ def test_show_base_being_ignored
18
+
19
+ assert_equal -100, IP.to_integer(-100)
20
+ assert_equal -100, IP.to_integer(-100, 0)
21
+ assert_equal -100, IP.to_integer(-100.0, 0)
22
+ assert_equal -100, IP.to_integer(-100.0, 10)
23
+
24
+ assert_equal -100, IP.to_integer('-100')
25
+ assert_equal -100, IP.to_integer('-100', 0)
26
+ assert_equal -100, IP.to_integer('-100', 10)
27
+ assert_equal -4, IP.to_integer('-100', 2)
28
+ end
29
+
30
+ def test_default_for_invalid_type
31
+
32
+ assert_equal 12345, IP.to_integer(12..345, default: 12345)
33
+ end
34
+
35
+ def test_to_integer_with_valid_values
36
+
37
+ assert_equal 0, IP.to_integer(0)
38
+ assert_equal +1, IP.to_integer(1)
39
+ assert_equal +1, IP.to_integer(+1)
40
+ assert_equal -1, IP.to_integer(-1)
41
+
42
+ assert_equal 0, IP.to_integer('0')
43
+ assert_equal +1, IP.to_integer('1')
44
+ assert_equal +1, IP.to_integer('+1')
45
+ assert_equal -1, IP.to_integer('-1')
46
+ end
47
+
48
+ def test_to_integer_with_invalid_values
49
+
50
+ assert_raise(TypeError) { IP.to_integer nil }
51
+ assert_raise(ArgumentError) { IP.to_integer '' }
52
+ assert_raise(ArgumentError) { IP.to_integer 'abc' }
53
+ assert_raise(ArgumentError) { IP.to_integer 'zero' }
54
+ assert_raise(ArgumentError) { IP.to_integer 'plus 1' }
55
+ assert_raise(ArgumentError) { IP.to_integer '/0' }
56
+ end
57
+
58
+ def test_to_integer_with_invalid_values_returning_nil
59
+
60
+ assert_nil IP.to_integer(nil, nil: true)
61
+ assert_nil IP.to_integer('', nil: true)
62
+ assert_nil IP.to_integer('abc', nil: true)
63
+ assert_nil IP.to_integer('zero', nil: true)
64
+ assert_nil IP.to_integer('plus 1', nil: true)
65
+ assert_nil IP.to_integer('/0', nil: true)
66
+ end
67
+
68
+ def test_to_integer_with_invalid_values_returning_0
69
+
70
+ assert_equal 0, IP.to_integer(nil, default: 0)
71
+ assert_equal 0, IP.to_integer('', default: 0)
72
+ assert_equal 0, IP.to_integer('abc', default: 0)
73
+ assert_equal 0, IP.to_integer('zero', default: 0)
74
+ assert_equal 0, IP.to_integer('plus 1', default: 0)
75
+ assert_equal 0, IP.to_integer('/0', default: 0)
76
+ end
77
+
78
+ def test_to_integer_with_invalid_values_returning_sentinel
79
+
80
+ assert_equal :sentinel, IP.to_integer(nil, default: :sentinel)
81
+ assert_equal :sentinel, IP.to_integer('', default: :sentinel)
82
+ assert_equal :sentinel, IP.to_integer('abc', default: :sentinel)
83
+ assert_equal :sentinel, IP.to_integer('zero', default: :sentinel)
84
+ assert_equal :sentinel, IP.to_integer('plus 1', default: :sentinel)
85
+ assert_equal :sentinel, IP.to_integer('/0', default: :sentinel)
86
+ end
87
+
88
+ def test_to_integer_with_invalid_values_returning_sentinel_of_nil
89
+
90
+ assert_equal nil, IP.to_integer(nil, default: nil)
91
+ assert_equal nil, IP.to_integer('', default: nil)
92
+ assert_equal nil, IP.to_integer('abc', default: nil)
93
+ assert_equal nil, IP.to_integer('zero', default: nil)
94
+ assert_equal nil, IP.to_integer('plus 1', default: nil)
95
+ assert_equal nil, IP.to_integer('/0', default: nil)
96
+ end
97
+
98
+ def test_to_integer_with_invalid_values_and_block
99
+
100
+ assert_equal nil, IP.to_integer(nil) { nil }
101
+ assert_equal nil, IP.to_integer('blah') { nil }
102
+
103
+ assert_equal 'one', IP.to_integer(nil) { 'one' }
104
+ assert_equal 'one', IP.to_integer('blah') { 'one' }
105
+
106
+ assert_raise(SomeRandomException) { IP.to_integer(nil) { raise SomeRandomException.new } }
107
+ end
108
+ end
109
+
110
+
@@ -7,10 +7,10 @@ require 'xqsr3/conversion/bool_parser'
7
7
  require 'xqsr3/extensions/test/unit'
8
8
  require 'test/unit'
9
9
 
10
- include ::Xqsr3::Conversion
11
-
12
10
  class Test_Xqsr3_ConversionMultiMap < Test::Unit::TestCase
13
11
 
12
+ include ::Xqsr3::Conversion
13
+
14
14
  def test_parse_normal
15
15
 
16
16
  assert_true BoolParser.to_bool 'true'
@@ -4,10 +4,14 @@ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
4
 
5
5
  require 'xqsr3/extensions/kernel/integer'
6
6
 
7
+ require 'xqsr3/extensions/test/unit'
8
+
7
9
  require 'test/unit'
8
10
 
9
11
  class Test_X_Kernel_Integer < Test::Unit::TestCase
10
12
 
13
+ class SomeRandomException < Exception; end
14
+
11
15
  def test_Integer_with_valid_values
12
16
 
13
17
  assert_equal 0, Integer(0)
@@ -70,6 +74,17 @@ class Test_X_Kernel_Integer < Test::Unit::TestCase
70
74
  assert_equal nil, Integer('plus 1', default: nil)
71
75
  assert_equal nil, Integer('/0', default: nil)
72
76
  end
77
+
78
+ def test_Integer_with_invalid_values_and_block
79
+
80
+ assert_equal nil, Integer(nil) { nil }
81
+ assert_equal nil, Integer('blah') { nil }
82
+
83
+ assert_equal 'one', Integer(nil) { 'one' }
84
+ assert_equal 'one', Integer('blah') { 'one' }
85
+
86
+ assert_raise(SomeRandomException) { Integer(nil) { raise SomeRandomException.new } }
87
+ end
73
88
  end
74
89
 
75
90
 
@@ -0,0 +1,37 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/string/truncate'
6
+
7
+ require 'xqsr3/extensions/test/unit'
8
+ require 'test/unit'
9
+
10
+ class Test_String_truncate < Test::Unit::TestCase
11
+
12
+ def test_empty_string
13
+
14
+ assert_equal '', ''.truncate(0)
15
+ assert_equal '', ''.truncate(1)
16
+ assert_equal '', ''.truncate(10)
17
+ end
18
+
19
+ def test_short_string
20
+
21
+ assert_equal '.', 'ab'.truncate(1)
22
+ assert_equal 'ab', 'ab'.truncate(2)
23
+ assert_equal 'ab', 'ab'.truncate(10)
24
+ end
25
+
26
+ def test_shortish_string
27
+
28
+ assert_equal '.', 'abcde'.truncate(1)
29
+ assert_equal '..', 'abcde'.truncate(2)
30
+ assert_equal '...', 'abcde'.truncate(3)
31
+ assert_equal 'a...', 'abcde'.truncate(4)
32
+ assert_equal 'abcde', 'abcde'.truncate(5)
33
+ assert_equal 'abcde', 'abcde'.truncate(10)
34
+ end
35
+ end
36
+
37
+
@@ -391,7 +391,7 @@ end
391
391
  assert(false, 'should not get here')
392
392
  rescue ArgumentError => ax
393
393
 
394
- assert_equal "option ':thingy' may not be nil", ax.message
394
+ assert_equal "option 'thingy' may not be nil", ax.message
395
395
  rescue => x
396
396
 
397
397
  assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
@@ -451,7 +451,7 @@ end
451
451
  assert(false, 'should not get here')
452
452
  rescue ArgumentError => ax
453
453
 
454
- assert_equal "option ':thingy' may not be nil", ax.message
454
+ assert_equal "option 'thingy' may not be nil", ax.message
455
455
  rescue => x
456
456
 
457
457
  assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
@@ -469,5 +469,103 @@ end
469
469
  assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
470
470
  end
471
471
  end
472
+
473
+ # test multiple option names
474
+
475
+ def check_method_multiple_option_names h, o, options = {}, &block
476
+
477
+ check_option h, o, options.merge({ }), &block
478
+ end
479
+
480
+ def test_multiple_option_names
481
+
482
+ # normal cases
483
+
484
+ thing = check_method_multiple_option_names({ thing: 123 }, :thing)
485
+ assert_equal 123, thing
486
+
487
+
488
+ thing = check_method_multiple_option_names({ thing: 123 }, :thingy, allow_nil: true)
489
+ assert_nil thing
490
+
491
+
492
+ begin
493
+ check_method_multiple_option_names({ thing: 123 }, :thingy)
494
+
495
+ assert(false, 'should not get here')
496
+ rescue ArgumentError => ax
497
+
498
+ assert_equal "option ':thingy' may not be nil", ax.message
499
+ rescue => x
500
+
501
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
502
+ end
503
+
504
+
505
+ # multiple-name cases
506
+
507
+
508
+ thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :thing ])
509
+ assert_equal 123, thing
510
+
511
+
512
+ thing = check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ], allow_nil: true)
513
+ assert_nil thing
514
+
515
+
516
+ begin
517
+ check_method_multiple_option_names({ thing: 123 }, [ :thingy, :Thingy ])
518
+
519
+ assert(false, 'should not get here')
520
+ rescue ArgumentError => ax
521
+
522
+ assert_equal "option ':thingy' may not be nil", ax.message
523
+ rescue => x
524
+
525
+ assert(false, "wrong exception type #{x.class}) (with message '#{x.message}'")
526
+ end
527
+
528
+ assert_raise_with_message(::ArgumentError, "option ':thingy' may not be nil") { check_option({ thing: 123 }, [ :thingy, :Thingy ]) }
529
+ assert_raise_with_message(::ArgumentError, "option ':Thingy' may not be nil") { check_option({ thing: 123 }, [ :Thingy, :thingy ]) }
530
+
531
+ # multiple-name cases where several present
532
+
533
+ assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thing, :thingy ])
534
+ assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :thingy, :thing ])
535
+
536
+ assert_equal 123, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thing, :thingy ])
537
+ assert_equal 45, check_method_multiple_option_names({ thing: 123, thingy: 45 }, [ :Thingy, :thingy, :thing ])
538
+ end
539
+
540
+ # test strip_str_whitespace
541
+
542
+ def check_method_strip_str_whitespace v, name, options = {}, &block
543
+
544
+ check_parameter v, name, options, &block
545
+ end
546
+
547
+ def test_strip_str_whitespace
548
+
549
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's')
550
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: false)
551
+ assert_equal ' ', check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: false)
552
+ assert_equal '', check_method_strip_str_whitespace(' ', 's', strip_str_whitespace: true)
553
+ assert_equal 'abc', check_method_strip_str_whitespace("\tabc ", 's', strip_str_whitespace: true)
554
+
555
+ assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace('', 's', reject_empty: true) }
556
+ assert_raise_with_message(::ArgumentError, /param.*s.*(?:may|must) not be empty/) { check_method_strip_str_whitespace(' ', 's', reject_empty: true, strip_str_whitespace: true) }
557
+ end
558
+
559
+
560
+ # test_allow_nil
561
+
562
+ def test_allow_nil
563
+
564
+ assert_raise_with_message(::ArgumentError, /parameter .*the_param.* may not be nil/) { check_parameter(nil, 'the_param') }
565
+
566
+ assert_nil(check_parameter(nil, 'the_param', allow_nil: true))
567
+
568
+ assert_nil(check_parameter(nil, 'the_param', nil: true))
569
+ end
472
570
  end
473
571
 
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.22.4
4
+ version: 0.26.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2019-02-28 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
@@ -26,6 +26,7 @@ files:
26
26
  - lib/xqsr3/containers/frequency_map.rb
27
27
  - lib/xqsr3/containers/multi_map.rb
28
28
  - lib/xqsr3/conversion/bool_parser.rb
29
+ - lib/xqsr3/conversion/integer_parser.rb
29
30
  - lib/xqsr3/diagnostics/exception_utilities.rb
30
31
  - lib/xqsr3/diagnostics/exceptions/with_cause.rb
31
32
  - lib/xqsr3/doc_.rb
@@ -52,6 +53,7 @@ files:
52
53
  - lib/xqsr3/extensions/string/starts_with.rb
53
54
  - lib/xqsr3/extensions/string/to_bool.rb
54
55
  - lib/xqsr3/extensions/string/to_symbol.rb
56
+ - lib/xqsr3/extensions/string/truncate.rb
55
57
  - lib/xqsr3/extensions/test/unit.rb
56
58
  - lib/xqsr3/extensions/test/unit/assert_eql.rb
57
59
  - lib/xqsr3/extensions/test/unit/assert_false.rb
@@ -73,6 +75,7 @@ files:
73
75
  - lib/xqsr3/string_utilities/quote_if.rb
74
76
  - lib/xqsr3/string_utilities/starts_with.rb
75
77
  - lib/xqsr3/string_utilities/to_symbol.rb
78
+ - lib/xqsr3/string_utilities/truncate.rb
76
79
  - lib/xqsr3/version.rb
77
80
  - lib/xqsr3/xml/utilities/compare.rb
78
81
  - test/unit/array_utilities/tc_join_with_or.rb
@@ -82,6 +85,7 @@ files:
82
85
  - test/unit/containers/tc_frequency_map.rb
83
86
  - test/unit/containers/tc_multi_map.rb
84
87
  - test/unit/containers/ts_all.rb
88
+ - test/unit/conversion/tc_integer_parser.rb
85
89
  - test/unit/conversion/tc_to_bool.rb
86
90
  - test/unit/conversion/ts_all.rb
87
91
  - test/unit/diagnostics/exceptions/tc_with_cause.rb
@@ -107,6 +111,7 @@ files:
107
111
  - test/unit/extensions/string/tc_quote_if.rb
108
112
  - test/unit/extensions/string/tc_starts_with.rb
109
113
  - test/unit/extensions/string/tc_to_symbol.rb
114
+ - test/unit/extensions/string/tc_truncate.rb
110
115
  - test/unit/extensions/string/ts_all.rb
111
116
  - test/unit/extensions/test/ts_all.rb
112
117
  - test/unit/extensions/test/unit/tc_assert_raise_with_message.rb
@@ -128,7 +133,7 @@ files:
128
133
  - test/unit/xml/utilities/ts_all.rb
129
134
  homepage: http://github.com/synesissoftware/xqsr3
130
135
  licenses:
131
- - BSD-3-Clause
136
+ - BSD-3-clause
132
137
  metadata: {}
133
138
  post_install_message:
134
139
  rdoc_options: []
@@ -146,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
151
  version: '0'
147
152
  requirements: []
148
153
  rubyforge_project:
149
- rubygems_version: 2.7.5
154
+ rubygems_version: 2.6.14.3
150
155
  signing_key:
151
156
  specification_version: 4
152
157
  summary: xqsr3