xqsr3 0.38.2 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -6
  3. data/examples/count_word_frequencies.md +12 -12
  4. data/examples/count_word_frequencies.rb +4 -4
  5. data/lib/xqsr3/array_utilities/join_with_or.rb +47 -47
  6. data/lib/xqsr3/array_utilities.rb +2 -2
  7. data/lib/xqsr3/command_line_utilities/map_option_string.rb +60 -60
  8. data/lib/xqsr3/command_line_utilities.rb +2 -2
  9. data/lib/xqsr3/containers/frequency_map.rb +399 -399
  10. data/lib/xqsr3/containers/multi_map.rb +448 -448
  11. data/lib/xqsr3/containers.rb +3 -3
  12. data/lib/xqsr3/conversion/bool_parser.rb +51 -51
  13. data/lib/xqsr3/conversion/integer_parser.rb +87 -87
  14. data/lib/xqsr3/conversion.rb +3 -3
  15. data/lib/xqsr3/diagnostics/exception_utilities.rb +145 -145
  16. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +90 -90
  17. data/lib/xqsr3/diagnostics/inspect_builder.rb +80 -80
  18. data/lib/xqsr3/diagnostics.rb +3 -3
  19. data/lib/xqsr3/doc_.rb +130 -130
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +12 -12
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +35 -35
  23. data/lib/xqsr3/extensions/enumerable/unique.rb +29 -28
  24. data/lib/xqsr3/extensions/hash/deep_transform.rb +1 -1
  25. data/lib/xqsr3/extensions/hash/except.rb +16 -16
  26. data/lib/xqsr3/extensions/hash/has_match.rb +10 -10
  27. data/lib/xqsr3/extensions/hash/match.rb +10 -10
  28. data/lib/xqsr3/extensions/hash/slice.rb +11 -11
  29. data/lib/xqsr3/extensions/hash.rb +1 -1
  30. data/lib/xqsr3/extensions/integer/to_s_grp.rb +118 -0
  31. data/lib/xqsr3/extensions/integer.rb +3 -0
  32. data/lib/xqsr3/extensions/io/writelines.rb +28 -28
  33. data/lib/xqsr3/extensions/kernel/integer.rb +20 -20
  34. data/lib/xqsr3/extensions/kernel/raise_with_options.rb +8 -8
  35. data/lib/xqsr3/extensions/kernel.rb +1 -0
  36. data/lib/xqsr3/extensions/string/ends_with.rb +1 -1
  37. data/lib/xqsr3/extensions/string/map_option_string.rb +4 -4
  38. data/lib/xqsr3/extensions/string/nil_if_empty.rb +1 -1
  39. data/lib/xqsr3/extensions/string/nil_if_whitespace.rb +1 -1
  40. data/lib/xqsr3/extensions/string/quote_if.rb +1 -1
  41. data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
  42. data/lib/xqsr3/extensions/string/to_bool.rb +8 -8
  43. data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
  44. data/lib/xqsr3/extensions/string/truncate.rb +1 -1
  45. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
  46. data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -6
  47. data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -6
  48. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +7 -7
  49. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -61
  50. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -7
  51. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -7
  52. data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -6
  53. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -36
  54. data/lib/xqsr3/extensions.rb +5 -5
  55. data/lib/xqsr3/hash_utilities/deep_transform.rb +65 -65
  56. data/lib/xqsr3/hash_utilities/key_matching.rb +77 -77
  57. data/lib/xqsr3/hash_utilities.rb +3 -3
  58. data/lib/xqsr3/internal_/test_unit_version_.rb +85 -85
  59. data/lib/xqsr3/io/writelines.rb +119 -119
  60. data/lib/xqsr3/quality/parameter_checking.rb +445 -445
  61. data/lib/xqsr3/quality.rb +2 -2
  62. data/lib/xqsr3/string_utilities/ends_with.rb +59 -59
  63. data/lib/xqsr3/string_utilities/nil_if_empty.rb +28 -28
  64. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +29 -29
  65. data/lib/xqsr3/string_utilities/quote_if.rb +50 -50
  66. data/lib/xqsr3/string_utilities/starts_with.rb +59 -59
  67. data/lib/xqsr3/string_utilities/to_symbol.rb +75 -75
  68. data/lib/xqsr3/string_utilities/truncate.rb +55 -55
  69. data/lib/xqsr3/string_utilities.rb +8 -8
  70. data/lib/xqsr3/version.rb +12 -12
  71. data/test/performance/frequency_map.rb +12 -12
  72. data/test/scratch/test_assert_raise_with_message.rb +11 -11
  73. data/test/unit/array_utilities/tc_join_with_or.rb +140 -140
  74. data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
  75. data/test/unit/containers/tc_frequency_map.rb +591 -591
  76. data/test/unit/containers/tc_multi_map.rb +558 -558
  77. data/test/unit/conversion/tc_integer_parser.rb +72 -72
  78. data/test/unit/conversion/tc_to_bool.rb +25 -25
  79. data/test/unit/diagnostics/exceptions/tc_with_cause.rb +165 -165
  80. data/test/unit/diagnostics/tc_exception_utilities.rb +156 -156
  81. data/test/unit/extensions/enumerable/tc_collect_with_index.rb +14 -14
  82. data/test/unit/extensions/enumerable/tc_detect_map.rb +20 -20
  83. data/test/unit/extensions/enumerable/tc_unique.rb +34 -34
  84. data/test/unit/extensions/hash/tc_deep_transform.rb +22 -22
  85. data/test/unit/extensions/hash/tc_except.rb +28 -28
  86. data/test/unit/extensions/hash/tc_slice.rb +13 -13
  87. data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
  88. data/test/unit/extensions/integer/ts_all.rb +12 -0
  89. data/test/unit/extensions/io/tc_writelines.rb +77 -77
  90. data/test/unit/extensions/kernel/tc_integer.rb +75 -75
  91. data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
  92. data/test/unit/extensions/object/tc_inspect.rb +50 -50
  93. data/test/unit/extensions/string/tc_bool.tb +24 -24
  94. data/test/unit/extensions/string/tc_ends_with.rb +53 -53
  95. data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
  96. data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
  97. data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
  98. data/test/unit/extensions/string/tc_quote_if.rb +18 -18
  99. data/test/unit/extensions/string/tc_starts_with.rb +53 -53
  100. data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
  101. data/test/unit/extensions/string/tc_truncate.rb +18 -18
  102. data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
  103. data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
  104. data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
  105. data/test/unit/hash_utilities/tc_has_match.rb +70 -70
  106. data/test/unit/hash_utilities/tc_match.rb +83 -83
  107. data/test/unit/io/tc_writelines.rb +106 -106
  108. data/test/unit/quality/tc_parameter_checking.rb +389 -389
  109. data/test/unit/string_utilities/tc_truncate.rb +27 -27
  110. data/test/unit/tc_version.rb +15 -15
  111. metadata +6 -2
@@ -2,16 +2,16 @@
2
2
  # ######################################################################## #
3
3
  # File: lib/xqsr3/hash_utilities/deep_transform.rb
4
4
  #
5
- # Purpose: Definition of the Xqsr3::HashUtilities::DeepTransform module
5
+ # Purpose: Definition of the ::Xqsr3::HashUtilities::DeepTransform module
6
6
  #
7
7
  # Created: 3rd June 2017
8
- # Updated: 11th December 2023
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-2023, Matthew Wilson and Synesis Information Systems
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
  #
@@ -58,94 +58,94 @@ module HashUtilities
58
58
 
59
59
  module DeepTransform
60
60
 
61
- private
62
- def self.do_deep_transform_on_hashlike_ h, &block # :nodoc:
61
+ private
62
+ def self.do_deep_transform_on_hashlike_ h, &block # :nodoc:
63
63
 
64
- ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :map ]
64
+ ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :map ]
65
65
 
66
- case block.arity
67
- when 1
66
+ case block.arity
67
+ when 1
68
68
 
69
- h =
70
- Hash[h.map do |k, v|
69
+ h =
70
+ Hash[h.map do |k, v|
71
71
 
72
- k = k.deep_transform(&block) if ::Hash === k
73
- v = v.deep_transform(&block) if ::Hash === v
72
+ k = k.deep_transform(&block) if ::Hash === k
73
+ v = v.deep_transform(&block) if ::Hash === v
74
74
 
75
- [yield(k), v]
76
- end]
77
- when 2
75
+ [yield(k), v]
76
+ end]
77
+ when 2
78
78
 
79
- h =
80
- Hash[h.map do |k, v|
79
+ h =
80
+ Hash[h.map do |k, v|
81
81
 
82
- k = k.deep_transform(&block) if ::Hash === k
83
- v = v.deep_transform(&block) if ::Hash === v
82
+ k = k.deep_transform(&block) if ::Hash === k
83
+ v = v.deep_transform(&block) if ::Hash === v
84
84
 
85
- yield(k, v)
86
- end]
87
- else
85
+ yield(k, v)
86
+ end]
87
+ else
88
88
 
89
- raise ArgumentError, "block arity must be 1 or 2"
90
- end
89
+ raise ArgumentError, "block arity must be 1 or 2"
90
+ end
91
91
 
92
- h
93
- end
92
+ h
93
+ end
94
94
 
95
- def do_deep_transform_on_self_ &block # :nodoc:
95
+ def do_deep_transform_on_self_ &block # :nodoc:
96
96
 
97
- ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[]=, :delete, :keys ]
97
+ ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[]=, :delete, :keys ]
98
98
 
99
- case block.arity
100
- when 1
99
+ case block.arity
100
+ when 1
101
101
 
102
- self.keys.each do |k|
102
+ self.keys.each do |k|
103
103
 
104
- v = self.delete k
104
+ v = self.delete k
105
105
 
106
- k = k.deep_transform(&block) if ::Hash === k
107
- v = v.deep_transform(&block) if ::Hash === v
106
+ k = k.deep_transform(&block) if ::Hash === k
107
+ v = v.deep_transform(&block) if ::Hash === v
108
108
 
109
- self[yield(k)] = v
110
- end
111
- when 2
109
+ self[yield(k)] = v
110
+ end
111
+ when 2
112
112
 
113
- self.keys.each do |k|
113
+ self.keys.each do |k|
114
114
 
115
- v = self.delete k
115
+ v = self.delete k
116
116
 
117
- k = k.deep_transform(&block) if ::Hash === k
118
- v = v.deep_transform(&block) if ::Hash === v
117
+ k = k.deep_transform(&block) if ::Hash === k
118
+ v = v.deep_transform(&block) if ::Hash === v
119
119
 
120
- k, v = yield(k, v)
121
- end
122
- else
120
+ k, v = yield(k, v)
121
+ end
122
+ else
123
123
 
124
- raise ArgumentError, "block arity must be 1 or 2"
125
- end
126
- end
127
- public
124
+ raise ArgumentError, "block arity must be 1 or 2"
125
+ end
126
+ end
127
+ public
128
128
 
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
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
- DeepTransform.do_deep_transform_on_hashlike_(self, &block)
136
- end
135
+ DeepTransform.do_deep_transform_on_hashlike_(self, &block)
136
+ end
137
137
 
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
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
- do_deep_transform_on_self_(&block)
148
- end
147
+ do_deep_transform_on_self_(&block)
148
+ end
149
149
 
150
150
  end # module DeepTransform
151
151
 
@@ -2,16 +2,16 @@
2
2
  # ######################################################################## #
3
3
  # File: lib/xqsr3/hash_utilities/key_matching.rb
4
4
  #
5
- # Purpose: Definition of the Xqsr3::HashUtilities::KeyMatching module
5
+ # Purpose: Definition of the ::Xqsr3::HashUtilities::KeyMatching module
6
6
  #
7
7
  # Created: 15th November 2017
8
- # Updated: 11th December 2023
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-2023, Matthew Wilson and Synesis Information Systems
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
  #
@@ -60,113 +60,113 @@ module HashUtilities
60
60
  # and #match methods
61
61
  module KeyMatching
62
62
 
63
- private
64
- def self.do_match_ h, re, **options # :nodoc:
63
+ private
64
+ def self.do_match_ h, re, **options # :nodoc:
65
65
 
66
- ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
66
+ ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
67
67
 
68
- return h[re] if h.has_key? re
68
+ return h[re] if h.has_key? re
69
69
 
70
- case re
71
- when ::Regexp
70
+ case re
71
+ when ::Regexp
72
72
 
73
- h.each do |k, v|
73
+ h.each do |k, v|
74
74
 
75
- case k
76
- when ::Regexp
75
+ case k
76
+ when ::Regexp
77
77
 
78
- next
79
- else
78
+ next
79
+ else
80
80
 
81
- return v if k.to_s =~ re
82
- end
83
- end
84
- else
81
+ return v if k.to_s =~ re
82
+ end
83
+ end
84
+ else
85
85
 
86
- h.each do |k, v|
86
+ h.each do |k, v|
87
87
 
88
- case k
89
- when ::Regexp
88
+ case k
89
+ when ::Regexp
90
90
 
91
- return v if re.to_s =~ k
92
- else
91
+ return v if re.to_s =~ k
92
+ else
93
93
 
94
- next
95
- end
96
- end
97
- end
94
+ next
95
+ end
96
+ end
97
+ end
98
98
 
99
- nil
100
- end
99
+ nil
100
+ end
101
101
 
102
- def self.do_has_match_ h, re, **options # :nodoc:
102
+ def self.do_has_match_ h, re, **options # :nodoc:
103
103
 
104
- ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
104
+ ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[], :has_key?, :each ]
105
105
 
106
- return true if h.has_key? re
106
+ return true if h.has_key? re
107
107
 
108
- case re
109
- when ::Regexp
108
+ case re
109
+ when ::Regexp
110
110
 
111
- h.each do |k, v|
111
+ h.each do |k, v|
112
112
 
113
- case k
114
- when ::Regexp
113
+ case k
114
+ when ::Regexp
115
115
 
116
- next
117
- else
116
+ next
117
+ else
118
118
 
119
- return true if k.to_s =~ re
120
- end
121
- end
122
- else
119
+ return true if k.to_s =~ re
120
+ end
121
+ end
122
+ else
123
123
 
124
- h.each do |k, v|
124
+ h.each do |k, v|
125
125
 
126
- case k
127
- when ::Regexp
126
+ case k
127
+ when ::Regexp
128
128
 
129
- return true if re.to_s =~ k
130
- else
129
+ return true if re.to_s =~ k
130
+ else
131
131
 
132
- next
133
- end
134
- end
135
- end
132
+ next
133
+ end
134
+ end
135
+ end
136
136
 
137
- false
138
- end
139
- public
137
+ false
138
+ end
139
+ public
140
140
 
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
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
- Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
147
- end
146
+ Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
147
+ end
148
148
 
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
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
- Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
154
- end
153
+ Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
154
+ end
155
155
 
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
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
- Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
162
- end
161
+ Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
162
+ end
163
163
 
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
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
- Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
169
- end
168
+ Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
169
+ end
170
170
 
171
171
  end # module KeyMatching
172
172
 
@@ -1,11 +1,11 @@
1
1
 
2
2
  %w{
3
3
 
4
- deep_transform
5
- key_matching
4
+ deep_transform
5
+ key_matching
6
6
  }.each do |name|
7
7
 
8
- require File.join(File.dirname(__FILE__), 'hash_utilities', name)
8
+ require File.join(File.dirname(__FILE__), 'hash_utilities', name)
9
9
  end
10
10
 
11
11
 
@@ -49,128 +49,128 @@ require 'test/unit'
49
49
 
50
50
  begin
51
51
 
52
- require 'test/unit/version'
52
+ require 'test/unit/version'
53
53
 
54
- # :stopdoc:
55
- # @!visibility private
56
- module Xqsr3
57
- # @!visibility private
58
- module Internal_ # :nodoc:
59
- # @!visibility private
60
- module TestUnitVersion_ # :nodoc:
54
+ # :stopdoc:
55
+ # @!visibility private
56
+ module Xqsr3
57
+ # @!visibility private
58
+ module Internal_ # :nodoc:
59
+ # @!visibility private
60
+ module TestUnitVersion_ # :nodoc:
61
61
 
62
- # @!visibility private
63
- TEST_UNIT_VERSION_ = Test::Unit::VERSION # :nodoc:
64
- end # module TestUnitVersion_
65
- end # module Internal_
66
- end # module Xqsr3
62
+ # @!visibility private
63
+ TEST_UNIT_VERSION_ = Test::Unit::VERSION # :nodoc:
64
+ end # module TestUnitVersion_
65
+ end # module Internal_
66
+ end # module Xqsr3
67
67
 
68
- # :startdoc:
69
- rescue LoadError
68
+ # :startdoc:
69
+ rescue LoadError
70
70
 
71
- # :stopdoc:
72
- # @!visibility private
73
- module Xqsr3
74
- # @!visibility private
75
- module Internal_ # :nodoc:
76
- # @!visibility private
77
- module TestUnitVersion_ # :nodoc:
71
+ # :stopdoc:
72
+ # @!visibility private
73
+ module Xqsr3
74
+ # @!visibility private
75
+ module Internal_ # :nodoc:
76
+ # @!visibility private
77
+ module TestUnitVersion_ # :nodoc:
78
78
 
79
- # @!visibility private
80
- TEST_UNIT_VERSION_ = :not_found # :nodoc:
81
- end # module TestUnitVersion_
82
- end # module Internal_
83
- end # module Xqsr3
79
+ # @!visibility private
80
+ TEST_UNIT_VERSION_ = :not_found # :nodoc:
81
+ end # module TestUnitVersion_
82
+ end # module Internal_
83
+ end # module Xqsr3
84
84
 
85
- # :startdoc:
86
- end
85
+ # :startdoc:
86
+ end
87
87
 
88
- # :stopdoc:
88
+ # :stopdoc:
89
89
 
90
- module Xqsr3
91
- module Internal_ # :nodoc:
92
- module TestUnitVersion_ # :nodoc:
90
+ module Xqsr3
91
+ module Internal_ # :nodoc:
92
+ module TestUnitVersion_ # :nodoc:
93
93
 
94
- if TEST_UNIT_VERSION_ == :not_found
94
+ if TEST_UNIT_VERSION_ == :not_found
95
95
 
96
- TEST_UNIT_VERSION_PARTS_ = []
96
+ TEST_UNIT_VERSION_PARTS_ = []
97
97
 
98
- TEST_UNIT_VERSION_MAJOR_ = nil # :nodoc:
99
- TEST_UNIT_VERSION_MINOR_ = nil # :nodoc:
100
- TEST_UNIT_VERSION_PATCH_ = nil # :nodoc:
101
- else
98
+ TEST_UNIT_VERSION_MAJOR_ = nil # :nodoc:
99
+ TEST_UNIT_VERSION_MINOR_ = nil # :nodoc:
100
+ TEST_UNIT_VERSION_PATCH_ = nil # :nodoc:
101
+ else
102
102
 
103
- TEST_UNIT_VERSION_PARTS_ = TEST_UNIT_VERSION_.split(/[.]/).collect { |n| n.to_i } # :nodoc:
103
+ TEST_UNIT_VERSION_PARTS_ = TEST_UNIT_VERSION_.split(/[.]/).collect { |n| n.to_i } # :nodoc:
104
104
 
105
- TEST_UNIT_VERSION_MAJOR_ = TEST_UNIT_VERSION_PARTS_[0] # :nodoc:
106
- TEST_UNIT_VERSION_MINOR_ = TEST_UNIT_VERSION_PARTS_[1] # :nodoc:
107
- TEST_UNIT_VERSION_PATCH_ = TEST_UNIT_VERSION_PARTS_[2] # :nodoc:
108
- end
105
+ TEST_UNIT_VERSION_MAJOR_ = TEST_UNIT_VERSION_PARTS_[0] # :nodoc:
106
+ TEST_UNIT_VERSION_MINOR_ = TEST_UNIT_VERSION_PARTS_[1] # :nodoc:
107
+ TEST_UNIT_VERSION_PATCH_ = TEST_UNIT_VERSION_PARTS_[2] # :nodoc:
108
+ end
109
109
 
110
- # @!visibility private
111
- def self.less_ a1, a2 # :nodoc:
110
+ # @!visibility private
111
+ def self.less_ a1, a2 # :nodoc:
112
112
 
113
- n_common = a1.size < a2.size ? a1.size : a2.size
113
+ n_common = a1.size < a2.size ? a1.size : a2.size
114
114
 
115
- (0...n_common).each do |ix|
115
+ (0...n_common).each do |ix|
116
116
 
117
- v1 = a1[ix]
118
- v2 = a2[ix]
117
+ v1 = a1[ix]
118
+ v2 = a2[ix]
119
119
 
120
- if v1 == v2
120
+ if v1 == v2
121
121
 
122
- next
123
- end
122
+ next
123
+ end
124
124
 
125
- if v1 < v2
125
+ if v1 < v2
126
126
 
127
- return true
128
- else
127
+ return true
128
+ else
129
129
 
130
- return false
131
- end
132
- end
130
+ return false
131
+ end
132
+ end
133
133
 
134
- if n_common != a2.size
134
+ if n_common != a2.size
135
135
 
136
- return true
137
- else
136
+ return true
137
+ else
138
138
 
139
- return false
140
- end
141
- end
139
+ return false
140
+ end
141
+ end
142
142
 
143
- # @!visibility private
144
- def self.is_major_at_least? j # :nodoc:
143
+ # @!visibility private
144
+ def self.is_major_at_least? j # :nodoc:
145
145
 
146
- return unless TEST_UNIT_VERSION_MAJOR_
146
+ return unless TEST_UNIT_VERSION_MAJOR_
147
147
 
148
- return j >= TEST_UNIT_VERSION_MAJOR_
149
- end
148
+ return j >= TEST_UNIT_VERSION_MAJOR_
149
+ end
150
150
 
151
- # @!visibility private
152
- def self.is_minor_at_least? n # :nodoc:
151
+ # @!visibility private
152
+ def self.is_minor_at_least? n # :nodoc:
153
153
 
154
- return unless TEST_UNIT_VERSION_MINOR_
154
+ return unless TEST_UNIT_VERSION_MINOR_
155
155
 
156
- return n >= TEST_UNIT_VERSION_MINOR_
157
- end
156
+ return n >= TEST_UNIT_VERSION_MINOR_
157
+ end
158
158
 
159
- # @!visibility private
160
- def self.is_at_least? v # :nodoc:
159
+ # @!visibility private
160
+ def self.is_at_least? v # :nodoc:
161
161
 
162
- v = v.split(/\./).collect { |n| n.to_i } if String === v
162
+ v = v.split(/\./).collect { |n| n.to_i } if String === v
163
163
 
164
- return !less_(TEST_UNIT_VERSION_PARTS_, v)
165
- end
164
+ return !less_(TEST_UNIT_VERSION_PARTS_, v)
165
+ end
166
166
 
167
- # @!visibility private
168
- def self.is_less? v # :nodoc:
167
+ # @!visibility private
168
+ def self.is_less? v # :nodoc:
169
169
 
170
- v = v.split(/\./).collect { |n| n.to_i } if String === v
170
+ v = v.split(/\./).collect { |n| n.to_i } if String === v
171
171
 
172
- return less_(TEST_UNIT_VERSION_PARTS_, v)
173
- end
172
+ return less_(TEST_UNIT_VERSION_PARTS_, v)
173
+ end
174
174
 
175
175
  end # module TestUnitVersion_
176
176
  end # module Internal_