xqsr3 0.32.2 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/lib/xqsr3/all_extensions.rb +6 -0
  3. data/lib/xqsr3/array_utilities.rb +10 -0
  4. data/lib/xqsr3/array_utilities/join_with_or.rb +7 -14
  5. data/lib/xqsr3/command_line_utilities.rb +10 -0
  6. data/lib/xqsr3/command_line_utilities/map_option_string.rb +21 -8
  7. data/lib/xqsr3/containers.rb +11 -0
  8. data/lib/xqsr3/containers/frequency_map.rb +19 -2
  9. data/lib/xqsr3/containers/multi_map.rb +316 -27
  10. data/lib/xqsr3/conversion.rb +11 -0
  11. data/lib/xqsr3/conversion/bool_parser.rb +11 -14
  12. data/lib/xqsr3/conversion/integer_parser.rb +10 -16
  13. data/lib/xqsr3/diagnostics.rb +11 -0
  14. data/lib/xqsr3/diagnostics/exception_utilities.rb +2 -2
  15. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +15 -7
  16. data/lib/xqsr3/diagnostics/inspect_builder.rb +16 -16
  17. data/lib/xqsr3/doc_.rb +138 -9
  18. data/lib/xqsr3/extensions.rb +13 -0
  19. data/lib/xqsr3/extensions/array.rb +3 -0
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +6 -0
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +5 -4
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +6 -7
  23. data/lib/xqsr3/extensions/hash.rb +5 -0
  24. data/lib/xqsr3/extensions/hash/has_match.rb +7 -0
  25. data/lib/xqsr3/extensions/hash/match.rb +7 -0
  26. data/lib/xqsr3/extensions/hash/slice.rb +22 -0
  27. data/lib/xqsr3/extensions/io/writelines.rb +38 -6
  28. data/lib/xqsr3/extensions/kernel/integer.rb +6 -13
  29. data/lib/xqsr3/extensions/string/to_bool.rb +4 -0
  30. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +1 -0
  31. data/lib/xqsr3/extensions/test/unit/assert_false.rb +1 -0
  32. data/lib/xqsr3/extensions/test/unit/assert_not.rb +1 -0
  33. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +1 -0
  34. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +25 -4
  35. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +1 -0
  36. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +1 -0
  37. data/lib/xqsr3/extensions/test/unit/assert_true.rb +1 -0
  38. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +3 -12
  39. data/lib/xqsr3/hash_utilities.rb +11 -0
  40. data/lib/xqsr3/hash_utilities/deep_transform.rb +2 -2
  41. data/lib/xqsr3/hash_utilities/key_matching.rb +6 -4
  42. data/lib/xqsr3/internal_/test_unit_version_.rb +30 -4
  43. data/lib/xqsr3/io/writelines.rb +55 -19
  44. data/lib/xqsr3/quality.rb +8 -1
  45. data/lib/xqsr3/quality/parameter_checking.rb +52 -78
  46. data/lib/xqsr3/string_utilities.rb +16 -0
  47. data/lib/xqsr3/string_utilities/ends_with.rb +16 -7
  48. data/lib/xqsr3/string_utilities/nil_if_empty.rb +8 -4
  49. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +9 -4
  50. data/lib/xqsr3/string_utilities/quote_if.rb +12 -14
  51. data/lib/xqsr3/string_utilities/starts_with.rb +23 -5
  52. data/lib/xqsr3/string_utilities/to_symbol.rb +24 -5
  53. data/lib/xqsr3/string_utilities/truncate.rb +20 -4
  54. data/lib/xqsr3/version.rb +3 -2
  55. data/test/unit/containers/tc_multi_map.rb +174 -16
  56. data/test/unit/extensions/hash/tc_hash.rb +6 -0
  57. data/test/unit/extensions/hash/tc_slice.rb +31 -0
  58. data/test/unit/extensions/io/tc_writelines.rb +36 -0
  59. metadata +16 -3
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/hash'
6
+
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/hash/slice'
6
+
7
+ class Test_Hash_slice < Test::Unit::TestCase
8
+
9
+ def test_empty
10
+
11
+ assert_equal ({}), ({}.slice())
12
+
13
+ assert_equal ({}), ({}.slice(:abc, 'def'))
14
+ end
15
+
16
+ def test_none_matching
17
+
18
+ assert_equal ({}), ({ abc: 'abc', 'def' => :def }.slice())
19
+ end
20
+
21
+ def test_all_matching
22
+
23
+ assert_equal ({ abc: 'abc', 'def' => :def }), ({ abc: 'abc', 'def' => :def }.slice(:abc, 'def'))
24
+ end
25
+
26
+ def test_some_matching
27
+
28
+ assert_equal ({ abc: 'abc' }), ({ abc: 'abc', 'def' => :def }.slice(:abc, 'ghi'))
29
+ end
30
+ end
31
+
@@ -22,6 +22,18 @@ class Test_IO_writelines < Test::Unit::TestCase
22
22
  assert_equal "abc\n", s.string
23
23
  end
24
24
 
25
+ def test_single_string_nolasteol
26
+
27
+ input = 'abc'
28
+
29
+ s = StringIO.new '', 'a'
30
+
31
+ r = ::IO.writelines s, input, no_last_eol: true
32
+
33
+ assert_equal 1, r
34
+ assert_equal "abc", s.string
35
+ end
36
+
25
37
  def test_single_string_in_array
26
38
 
27
39
  input = [ 'abc' ]
@@ -46,6 +58,18 @@ class Test_IO_writelines < Test::Unit::TestCase
46
58
  assert_equal "abc\n", s.string
47
59
  end
48
60
 
61
+ def test_single_string_in_hash_nolasteol
62
+
63
+ input = { 'abc' => '' }
64
+
65
+ s = StringIO.new '', 'a'
66
+
67
+ r = ::IO.writelines s, input, no_last_eol: true
68
+
69
+ assert_equal 1, r
70
+ assert_equal "abc", s.string
71
+ end
72
+
49
73
  def test_two_strings_in_array
50
74
 
51
75
  input = [ 'abc', 'def' ]
@@ -82,6 +106,18 @@ class Test_IO_writelines < Test::Unit::TestCase
82
106
  assert_equal "abc\ndef\n", s.string
83
107
  end
84
108
 
109
+ def test_two_strings_in_hash_nolasteol
110
+
111
+ input = { 'ab' => 'c', 'de' => 'f' }
112
+
113
+ s = StringIO.new '', 'a'
114
+
115
+ r = ::IO.writelines s, input, no_last_eol: true
116
+
117
+ assert_equal 2, r
118
+ assert_equal "abc\ndef", s.string
119
+ end
120
+
85
121
  def test_ten_strings_in_array
86
122
 
87
123
  input = (0...10).map { |i| i.to_s }
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.32.2
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2020-05-26 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
@@ -23,16 +23,24 @@ files:
23
23
  - README.md
24
24
  - examples/count_word_frequencies.md
25
25
  - examples/count_word_frequencies.rb
26
+ - lib/xqsr3/all_extensions.rb
27
+ - lib/xqsr3/array_utilities.rb
26
28
  - lib/xqsr3/array_utilities/join_with_or.rb
29
+ - lib/xqsr3/command_line_utilities.rb
27
30
  - lib/xqsr3/command_line_utilities/map_option_string.rb
31
+ - lib/xqsr3/containers.rb
28
32
  - lib/xqsr3/containers/frequency_map.rb
29
33
  - lib/xqsr3/containers/multi_map.rb
34
+ - lib/xqsr3/conversion.rb
30
35
  - lib/xqsr3/conversion/bool_parser.rb
31
36
  - lib/xqsr3/conversion/integer_parser.rb
37
+ - lib/xqsr3/diagnostics.rb
32
38
  - lib/xqsr3/diagnostics/exception_utilities.rb
33
39
  - lib/xqsr3/diagnostics/exceptions/with_cause.rb
34
40
  - lib/xqsr3/diagnostics/inspect_builder.rb
35
41
  - lib/xqsr3/doc_.rb
42
+ - lib/xqsr3/extensions.rb
43
+ - lib/xqsr3/extensions/array.rb
36
44
  - lib/xqsr3/extensions/array/join_with_or.rb
37
45
  - lib/xqsr3/extensions/enumerable.rb
38
46
  - lib/xqsr3/extensions/enumerable/collect_with_index.rb
@@ -42,6 +50,7 @@ files:
42
50
  - lib/xqsr3/extensions/hash/deep_transform.rb
43
51
  - lib/xqsr3/extensions/hash/has_match.rb
44
52
  - lib/xqsr3/extensions/hash/match.rb
53
+ - lib/xqsr3/extensions/hash/slice.rb
45
54
  - lib/xqsr3/extensions/io.rb
46
55
  - lib/xqsr3/extensions/io/writelines.rb
47
56
  - lib/xqsr3/extensions/kernel.rb
@@ -67,12 +76,14 @@ files:
67
76
  - lib/xqsr3/extensions/test/unit/assert_superclass_of.rb
68
77
  - lib/xqsr3/extensions/test/unit/assert_true.rb
69
78
  - lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb
79
+ - lib/xqsr3/hash_utilities.rb
70
80
  - lib/xqsr3/hash_utilities/deep_transform.rb
71
81
  - lib/xqsr3/hash_utilities/key_matching.rb
72
82
  - lib/xqsr3/internal_/test_unit_version_.rb
73
83
  - lib/xqsr3/io/writelines.rb
74
84
  - lib/xqsr3/quality.rb
75
85
  - lib/xqsr3/quality/parameter_checking.rb
86
+ - lib/xqsr3/string_utilities.rb
76
87
  - lib/xqsr3/string_utilities/ends_with.rb
77
88
  - lib/xqsr3/string_utilities/nil_if_empty.rb
78
89
  - lib/xqsr3/string_utilities/nil_if_whitespace.rb
@@ -102,6 +113,8 @@ files:
102
113
  - test/unit/extensions/enumerable/tc_unique.rb
103
114
  - test/unit/extensions/enumerable/ts_all.rb
104
115
  - test/unit/extensions/hash/tc_deep_transform.rb
116
+ - test/unit/extensions/hash/tc_hash.rb
117
+ - test/unit/extensions/hash/tc_slice.rb
105
118
  - test/unit/extensions/hash/ts_all.rb
106
119
  - test/unit/extensions/io/tc_writelines.rb
107
120
  - test/unit/extensions/io/ts_all.rb
@@ -157,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
170
  version: '0'
158
171
  requirements: []
159
172
  rubyforge_project:
160
- rubygems_version: 2.2.5
173
+ rubygems_version: 2.7.6
161
174
  signing_key:
162
175
  specification_version: 4
163
176
  summary: xqsr3