xqsr3 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bac00397c53de860cb2094d8b0d0294ac2df4d0
4
- data.tar.gz: 97b0e53955c9700186216d9f8e79a3788151dbc7
3
+ metadata.gz: 85fb2c4cd56ed6ce994a02e294d9c57763fbaa93
4
+ data.tar.gz: fe8a334773139b5ed80401ca985637fa7e9127f3
5
5
  SHA512:
6
- metadata.gz: 794f86ebad8a99416f0b43f85bb55604d40b85887819844aba99632ce1fe3151cafbbc831c356a65019ee8463da54b33256456ee0f0f055da8758bf7f91d2e1f
7
- data.tar.gz: 2b6c1dee8c9d5b697e32a228ac8b371757e32a2f73e1a24d4832233aae32a0f3543595d15314119e5ec6f7a21573d44b8219df415975110e16d2d8bdf35c48a2
6
+ metadata.gz: 1f15b2cd66718fd119684f11c1f90214b4e12de9e33071f4154abc0cfdb6e8e213eb3c4027444c556f84abb81a8766d29a72274a09a00242790fb03bf58557df
7
+ data.tar.gz: 4787615d140647f606bcb6b225e15fb6dbf7b9a723cf87ee48187f509de1b3d3f980febdd1db30c74414b781a5da428c40085eb645e3f3fe832917c0025caee0
@@ -5,7 +5,7 @@
5
5
  # Purpose: Definition of the ParameterChecking module
6
6
  #
7
7
  # Created: 12th February 2015
8
- # Updated: 1st November 2017
8
+ # Updated: 7th December 2017
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -77,25 +77,6 @@ module ParameterChecking
77
77
  def self.included base
78
78
 
79
79
  base.extend self
80
-
81
- base.class_eval do
82
-
83
- public
84
- def self.check_parameter value, name, options = {}, &block
85
-
86
- Util_.check_parameter value, name, options, &block
87
- end
88
-
89
- # @see check_parameter
90
- #
91
- # @note This is obsolete, and will be removed in a future
92
- # version. Please use +check_parameter+ instead
93
- public
94
- def self.check_param value, name, options = {}, &block
95
-
96
- Util_.check_parameter value, name, options, &block
97
- end
98
- end
99
80
  end
100
81
 
101
82
  # Check a given parameter (value=+value+, name=+name+) for type and value
@@ -61,8 +61,6 @@ module QuoteIf
61
61
 
62
62
  def self.string_quote_if_array_ s, options
63
63
 
64
- #$stderr.puts "#{self}#{__method__}(s (#{s.class})='#{s}', options (#{options.class})='#{options}'"
65
-
66
64
  s = s.to_s unless String === s
67
65
 
68
66
  quotes = options[:quotes] || [ '"', '"' ]
@@ -70,8 +68,6 @@ module QuoteIf
70
68
 
71
69
  quotables = options[:quotables] || /\s/
72
70
 
73
- #$stderr.puts "quotables (#{quotables.class}): [#{quotables}]"
74
-
75
71
  case quotables
76
72
  when ::String
77
73
 
data/lib/xqsr3/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Purpose: Version for Xqsr3 library
6
6
  #
7
7
  # Created: 3rd April 2016
8
- # Updated: 22nd November 2017
8
+ # Updated: 7th December 2017
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.15.2'
53
+ VERSION = '0.15.3'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -8,30 +8,87 @@ require 'test/unit'
8
8
 
9
9
  class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
10
10
 
11
- module TestConstants
11
+ PC = ::Xqsr3::Quality::ParameterChecking
12
+
13
+ # test 1
14
+
15
+ def check_method_1 a
16
+
17
+ PC.check_param a, 'a'
18
+ end
19
+
20
+ def test_1
21
+
22
+ assert_raise ArgumentError do
23
+
24
+ check_method_1(nil)
25
+ end
26
+
27
+ assert_equal true, check_method_1(true)
28
+ assert_equal '', check_method_1('')
29
+ assert_equal [], check_method_1([])
30
+ assert_equal Hash.new, check_method_1(Hash.new)
12
31
  end
13
- include TestConstants
32
+
33
+
34
+ # test 2
35
+ end
36
+
37
+ class Test_parameter_checks_as_included_module < Test::Unit::TestCase
14
38
 
15
39
  include ::Xqsr3::Quality::ParameterChecking
16
40
 
41
+ # test 0
42
+
43
+ def test_access_control_instance
44
+
45
+ assert private_methods.include?(:check_param), "check_param() must be a private method of the instance"
46
+ assert private_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
47
+
48
+ assert self.class.private_instance_methods.include?(:check_param), "check_param() must be a private method of the instance"
49
+ assert self.class.private_instance_methods.include?(:check_parameter), "check_param() must be a private method of the instance"
50
+ end
51
+
52
+ def test_access_control_private
53
+
54
+ assert self.class.private_methods.include?(:check_param), "check_param() must be a private method of the class"
55
+ assert self.class.private_methods.include?(:check_parameter), "check_param() must be a private method of the class"
56
+ end
57
+
17
58
 
18
59
  # test 1
19
60
 
20
61
  def check_method_1 a
21
62
 
22
- self.class.check_param a, 'a'
63
+ check_param a, 'a'
64
+ end
65
+
66
+ def self.check_method_1_class a
67
+
68
+ check_param a, 'a'
23
69
  end
24
70
 
25
71
  def test_1
26
72
 
27
73
  assert_raise ArgumentError do
74
+
28
75
  check_method_1(nil)
29
76
  end
30
77
 
78
+ assert_raise ArgumentError do
79
+
80
+ self.class.check_method_1_class(nil)
81
+ end
82
+
31
83
  assert_equal true, check_method_1(true)
32
84
  assert_equal '', check_method_1('')
33
85
  assert_equal [], check_method_1([])
34
86
  assert_equal Hash.new, check_method_1(Hash.new)
87
+
88
+ assert_equal true, self.class.check_method_1_class(true)
89
+ assert_equal '', self.class.check_method_1_class('')
90
+ assert_equal [], self.class.check_method_1_class([])
91
+ assert_equal Hash.new, self.class.check_method_1_class(Hash.new)
35
92
  end
36
93
 
37
94
 
@@ -39,7 +96,7 @@ class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
39
96
 
40
97
  def check_method_2 a, types, options = {}
41
98
 
42
- self.class.check_param a, 'a', options.merge({ types: types })
99
+ check_param a, 'a', options.merge({ types: types })
43
100
  end
44
101
 
45
102
  def test_2
@@ -58,7 +115,7 @@ class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
58
115
 
59
116
  def check_method_3 a, types, values, options = {}
60
117
 
61
- self.class.check_param a, 'a', options.merge({ types: types, values: values })
118
+ check_param a, 'a', options.merge({ types: types, values: values })
62
119
  end
63
120
 
64
121
  def test_3
@@ -79,7 +136,7 @@ class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
79
136
 
80
137
  def check_method_4 a, types, values, options = {}, &block
81
138
 
82
- self.class.check_param a, 'a', options.merge({ types: types, values: values }), &block
139
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
83
140
  end
84
141
 
85
142
  def test_4
@@ -116,7 +173,7 @@ class Test_parameter_checks_as_separate_module < Test::Unit::TestCase
116
173
 
117
174
  def check_method_5 a, options = {}
118
175
 
119
- self.class.check_param a, 'a', options
176
+ check_param a, 'a', options
120
177
  end
121
178
 
122
179
  def test_5
@@ -145,7 +202,7 @@ end
145
202
 
146
203
  def check_method_6 a, types, values, options = {}, &block
147
204
 
148
- self.class.check_param a, 'a', options.merge({ types: types, values: values }), &block
205
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
149
206
  end
150
207
 
151
208
  def test_6
@@ -181,7 +238,7 @@ end
181
238
 
182
239
  def check_method_7 a, types, values, options = {}, &block
183
240
 
184
- self.class.check_param a, 'a', options.merge({ types: types, values: values }), &block
241
+ check_param a, 'a', options.merge({ types: types, values: values }), &block
185
242
  end
186
243
 
187
244
  def test_7
@@ -228,7 +285,7 @@ end
228
285
 
229
286
  def check_responds_to a, messages, options = {}, &block
230
287
 
231
- self.class.check_param a, 'a', options.merge({ responds_to: messages }), &block
288
+ check_param a, 'a', options.merge({ responds_to: messages }), &block
232
289
  end
233
290
 
234
291
  def test_responds_to
@@ -246,17 +303,29 @@ end
246
303
 
247
304
  def check_method_type a, type
248
305
 
249
- self.class.check_parameter a, 'a', type: type
306
+ check_parameter a, 'a', type: type
307
+ end
308
+
309
+ def self.check_method_type_class a, type
310
+
311
+ check_parameter a, 'a', type: type
250
312
  end
251
313
 
252
314
  def test_type
253
315
 
254
- check_method_type '', ::String
316
+ assert_kind_of ::String, check_method_type('', ::String)
255
317
 
256
318
  assert_raise TypeError do
257
319
 
258
320
  check_method_type :sym, ::String
259
321
  end
322
+
323
+ assert_kind_of ::String, self.class.check_method_type_class('', ::String)
324
+
325
+ assert_raise TypeError do
326
+
327
+ self.class.check_method_type_class :sym, ::String
328
+ end
260
329
  end
261
330
  end
262
331
 
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.15.2
4
+ version: 0.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-22 00:00:00.000000000 Z
11
+ date: 2017-12-07 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
@@ -19,44 +19,42 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - LICENSE
23
- - README.md
24
22
  - lib/xqsr3/command_line_utilities/map_option_string.rb
25
23
  - lib/xqsr3/containers/frequency_map.rb
26
24
  - lib/xqsr3/containers/multi_map.rb
27
25
  - lib/xqsr3/conversion/bool_parser.rb
28
26
  - lib/xqsr3/diagnostics/exception_utilities.rb
29
27
  - lib/xqsr3/doc_.rb
30
- - lib/xqsr3/extensions/enumerable.rb
31
28
  - lib/xqsr3/extensions/enumerable/collect_with_index.rb
32
29
  - lib/xqsr3/extensions/enumerable/unique.rb
33
- - lib/xqsr3/extensions/hash.rb
30
+ - lib/xqsr3/extensions/enumerable.rb
34
31
  - lib/xqsr3/extensions/hash/deep_transform.rb
35
32
  - lib/xqsr3/extensions/hash/has_match.rb
36
33
  - lib/xqsr3/extensions/hash/match.rb
37
- - lib/xqsr3/extensions/io.rb
34
+ - lib/xqsr3/extensions/hash.rb
38
35
  - lib/xqsr3/extensions/io/writelines.rb
39
- - lib/xqsr3/extensions/kernel.rb
36
+ - lib/xqsr3/extensions/io.rb
40
37
  - lib/xqsr3/extensions/kernel/integer.rb
41
38
  - lib/xqsr3/extensions/kernel/raise_with_options.rb
42
- - lib/xqsr3/extensions/string.rb
39
+ - lib/xqsr3/extensions/kernel.rb
43
40
  - lib/xqsr3/extensions/string/ends_with.rb
44
41
  - lib/xqsr3/extensions/string/map_option_string.rb
45
42
  - lib/xqsr3/extensions/string/quote_if.rb
46
43
  - lib/xqsr3/extensions/string/starts_with.rb
47
44
  - lib/xqsr3/extensions/string/to_bool.rb
48
45
  - lib/xqsr3/extensions/string/to_symbol.rb
49
- - lib/xqsr3/extensions/test/unit.rb
46
+ - lib/xqsr3/extensions/string.rb
50
47
  - lib/xqsr3/extensions/test/unit/assert_eql.rb
51
48
  - lib/xqsr3/extensions/test/unit/assert_false.rb
52
49
  - lib/xqsr3/extensions/test/unit/assert_not.rb
53
50
  - lib/xqsr3/extensions/test/unit/assert_not_eql.rb
54
51
  - lib/xqsr3/extensions/test/unit/assert_true.rb
52
+ - lib/xqsr3/extensions/test/unit.rb
55
53
  - lib/xqsr3/hash_utilities/deep_transform.rb
56
54
  - lib/xqsr3/hash_utilities/key_matching.rb
57
55
  - lib/xqsr3/io/writelines.rb
58
- - lib/xqsr3/quality.rb
59
56
  - lib/xqsr3/quality/parameter_checking.rb
57
+ - lib/xqsr3/quality.rb
60
58
  - lib/xqsr3/string_utilities/ends_with.rb
61
59
  - lib/xqsr3/string_utilities/quote_if.rb
62
60
  - lib/xqsr3/string_utilities/starts_with.rb
@@ -102,6 +100,8 @@ files:
102
100
  - test/unit/xml/ts_all.rb
103
101
  - test/unit/xml/utilities/tc_compare.rb
104
102
  - test/unit/xml/utilities/ts_all.rb
103
+ - README.md
104
+ - LICENSE
105
105
  homepage: http://github.com/synesissoftware/xqsr3
106
106
  licenses:
107
107
  - 3-clause BSD
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.4.2
125
+ rubygems_version: 2.0.14.1
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: xqsr3