xqsr3 0.38.1.1 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -6
  3. data/examples/count_word_frequencies.md +13 -13
  4. data/examples/count_word_frequencies.rb +5 -5
  5. data/lib/xqsr3/array_utilities/join_with_or.rb +53 -54
  6. data/lib/xqsr3/array_utilities.rb +2 -2
  7. data/lib/xqsr3/command_line_utilities/map_option_string.rb +66 -67
  8. data/lib/xqsr3/command_line_utilities.rb +2 -2
  9. data/lib/xqsr3/containers/frequency_map.rb +405 -404
  10. data/lib/xqsr3/containers/multi_map.rb +454 -453
  11. data/lib/xqsr3/containers.rb +3 -3
  12. data/lib/xqsr3/conversion/bool_parser.rb +56 -57
  13. data/lib/xqsr3/conversion/integer_parser.rb +92 -93
  14. data/lib/xqsr3/conversion.rb +3 -3
  15. data/lib/xqsr3/diagnostics/exception_utilities.rb +152 -151
  16. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +99 -95
  17. data/lib/xqsr3/diagnostics/inspect_builder.rb +86 -86
  18. data/lib/xqsr3/diagnostics.rb +3 -3
  19. data/lib/xqsr3/doc_.rb +136 -136
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +18 -17
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +41 -41
  23. data/lib/xqsr3/extensions/enumerable/unique.rb +32 -31
  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 +34 -34
  33. data/lib/xqsr3/extensions/kernel/integer.rb +26 -26
  34. data/lib/xqsr3/extensions/kernel/raise_with_options.rb +15 -14
  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 -5
  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 -2
  41. data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
  42. data/lib/xqsr3/extensions/string/to_bool.rb +8 -9
  43. data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
  44. data/lib/xqsr3/extensions/string/truncate.rb +1 -2
  45. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
  46. data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -7
  47. data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -7
  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 -62
  50. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -8
  51. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -8
  52. data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -7
  53. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -38
  54. data/lib/xqsr3/extensions.rb +5 -5
  55. data/lib/xqsr3/hash_utilities/deep_transform.rb +71 -71
  56. data/lib/xqsr3/hash_utilities/key_matching.rb +82 -82
  57. data/lib/xqsr3/hash_utilities.rb +3 -3
  58. data/lib/xqsr3/internal_/test_unit_version_.rb +130 -88
  59. data/lib/xqsr3/io/writelines.rb +125 -125
  60. data/lib/xqsr3/quality/parameter_checking.rb +452 -453
  61. data/lib/xqsr3/quality.rb +2 -2
  62. data/lib/xqsr3/string_utilities/ends_with.rb +64 -64
  63. data/lib/xqsr3/string_utilities/nil_if_empty.rb +33 -34
  64. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +35 -35
  65. data/lib/xqsr3/string_utilities/quote_if.rb +55 -56
  66. data/lib/xqsr3/string_utilities/starts_with.rb +64 -64
  67. data/lib/xqsr3/string_utilities/to_symbol.rb +80 -80
  68. data/lib/xqsr3/string_utilities/truncate.rb +60 -61
  69. data/lib/xqsr3/string_utilities.rb +8 -8
  70. data/lib/xqsr3/version.rb +19 -20
  71. data/test/performance/frequency_map.rb +13 -27
  72. data/test/scratch/test_assert_raise_with_message.rb +12 -13
  73. data/test/unit/array_utilities/tc_join_with_or.rb +140 -142
  74. data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
  75. data/test/unit/containers/tc_frequency_map.rb +607 -554
  76. data/test/unit/containers/tc_multi_map.rb +573 -522
  77. data/test/unit/conversion/tc_integer_parser.rb +73 -73
  78. data/test/unit/conversion/tc_to_bool.rb +26 -26
  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_hash.rb +1 -1
  87. data/test/unit/extensions/hash/tc_slice.rb +14 -14
  88. data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
  89. data/test/unit/extensions/integer/ts_all.rb +12 -0
  90. data/test/unit/extensions/io/tc_writelines.rb +77 -77
  91. data/test/unit/extensions/kernel/tc_integer.rb +75 -75
  92. data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
  93. data/test/unit/extensions/object/tc_inspect.rb +51 -51
  94. data/test/unit/extensions/string/tc_bool.tb +24 -24
  95. data/test/unit/extensions/string/tc_ends_with.rb +53 -53
  96. data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
  97. data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
  98. data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
  99. data/test/unit/extensions/string/tc_quote_if.rb +18 -18
  100. data/test/unit/extensions/string/tc_starts_with.rb +53 -53
  101. data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
  102. data/test/unit/extensions/string/tc_truncate.rb +18 -18
  103. data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
  104. data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
  105. data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
  106. data/test/unit/hash_utilities/tc_has_match.rb +70 -70
  107. data/test/unit/hash_utilities/tc_match.rb +83 -83
  108. data/test/unit/io/tc_writelines.rb +106 -108
  109. data/test/unit/quality/tc_parameter_checking.rb +390 -390
  110. data/test/unit/string_utilities/tc_truncate.rb +28 -28
  111. data/test/unit/tc_version.rb +15 -15
  112. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d79a8cd3b6c08ec9a3a6a651c59ffd38696ed67cddedff283c3b66ff9c1b2e8
4
- data.tar.gz: a4e9ba8e5b9923122f3fe9cd583d69588b09d60b67f95cc1bb1e1a9630b537b0
3
+ metadata.gz: 14aa286501609225e115c827067c4c28e95bddbdf0627fdc12cf3d2d97bf46b5
4
+ data.tar.gz: 50b100e12c9e6e13408a32da41f5a24a600b776ac04351c602b2084727dc71d1
5
5
  SHA512:
6
- metadata.gz: ed91a12776bccced75b2f278eb424e7e868370732139441e40ea6c76baa8cd61b1f00fbc49b932eb59763ebf0dbf42554748715d3a182cc9f695aca18816fa4e
7
- data.tar.gz: df3c844552eadc9c66496ac21e1d979aedd3fec2dbce2fa25e6a1e631b957cf58ffd7c7c4fa072a5a102f1d58f99e4c1334fdc1c1240b2a3af0cd5e31e16efaf
6
+ metadata.gz: 21121329a55503ed6c7f7482adcb939ca57fb949db08542434062b656e2cbaa635eeb69efb33863576d3818e0a0cf670816fb4ed8c1d6b37e188a9ed3b60d222
7
+ data.tar.gz: 2f77fe88582f91560deb35660f6c0829a63fbc45c0c8051531b609dfec1c6f2abe4a875d6601851928c3cb80174073dddc0bcb9549a71a6d8f9046a95663d44d
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # xqsr3
1
+ # xqsr3 <!-- omit in toc -->
2
+
2
3
  e**X**tensions by fine **Q**uantum for **S**tandard **R**uby and **3**rd-party libraries
3
4
 
4
5
  [![Gem Version](https://badge.fury.io/rb/xqsr3.svg)](https://badge.fury.io/rb/xqsr3)
@@ -11,12 +12,17 @@ It has **no dependencies** on any other non-standard library.
11
12
 
12
13
  It may be pronounced (lamely) as "excusers".
13
14
 
14
- ## Table of Contents
15
+ ## Table of Contents <!-- omit in toc -->
15
16
 
16
- 1. [Introduction](#introduction)
17
- 2. [Installation](#installation)
18
- 3. [Components](#components)
19
- 4. [Project Information](#project-information)
17
+ - [Introduction](#introduction)
18
+ - [Installation](#installation)
19
+ - [Components](#components)
20
+ - [Examples](#examples)
21
+ - [Project Information](#project-information)
22
+ - [Where to get help](#where-to-get-help)
23
+ - [Contribution guidelines](#contribution-guidelines)
24
+ - [Related projects](#related-projects)
25
+ - [License](#license)
20
26
 
21
27
  ## Installation
22
28
 
@@ -104,3 +110,6 @@ and a development dependency of:
104
110
 
105
111
  **xqsr3** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details.
106
112
 
113
+
114
+ <!-- ########################### end of file ########################### -->
115
+
@@ -8,7 +8,7 @@ Simple example illustrating use of ``FrequencyMap`` class.
8
8
 
9
9
  ```ruby
10
10
 
11
- #!/usr/bin/env ruby
11
+ #! /usr/bin/env ruby
12
12
 
13
13
  # examples/count_word_frequencies.rb
14
14
 
@@ -32,9 +32,9 @@ words.each { |word| fm << word }
32
32
 
33
33
  fm.each_by_frequency do |word, frequency|
34
34
 
35
- next if 1 == frequency
35
+ next if 1 == frequency
36
36
 
37
- $stdout.puts "\t#{word}\t#{frequency}"
37
+ $stdout.puts "\t#{word}\t#{frequency}"
38
38
  end
39
39
  puts
40
40
 
@@ -45,9 +45,9 @@ fm = FrequencyMap::ByElement[*words]
45
45
 
46
46
  fm.each_by_frequency do |word, frequency|
47
47
 
48
- next if 1 == frequency
48
+ next if 1 == frequency
49
49
 
50
- $stdout.puts "\t#{word}\t#{frequency}"
50
+ $stdout.puts "\t#{word}\t#{frequency}"
51
51
  end
52
52
  puts
53
53
 
@@ -67,16 +67,16 @@ When run, this produces the following output:
67
67
  Analyse DATA words via FrequencyMap
68
68
 
69
69
  1. Manually (showing items with 2+ occurrences):
70
- in 3
71
- dolor 2
72
- dolore 2
73
- ut 2
70
+ in 3
71
+ dolor 2
72
+ dolore 2
73
+ ut 2
74
74
 
75
75
  2. Via ByElement (showing items with 2+ occurrences):
76
- in 3
77
- dolor 2
78
- dolore 2
79
- ut 2
76
+ in 3
77
+ dolor 2
78
+ dolore 2
79
+ ut 2
80
80
  ```
81
81
 
82
82
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  # examples/count_word_frequencies.rb
4
4
 
@@ -23,9 +23,9 @@ words.each { |word| fm << word }
23
23
 
24
24
  fm.each_by_frequency do |word, frequency|
25
25
 
26
- next if 1 == frequency
26
+ next if 1 == frequency
27
27
 
28
- $stdout.puts "\t#{word}\t#{frequency}"
28
+ $stdout.puts "\t#{word}\t#{frequency}"
29
29
  end
30
30
  puts
31
31
 
@@ -36,9 +36,9 @@ fm = FrequencyMap::ByElement[*words]
36
36
 
37
37
  fm.each_by_frequency do |word, frequency|
38
38
 
39
- next if 1 == frequency
39
+ next if 1 == frequency
40
40
 
41
- $stdout.puts "\t#{word}\t#{frequency}"
41
+ $stdout.puts "\t#{word}\t#{frequency}"
42
42
  end
43
43
  puts
44
44
 
@@ -1,18 +1,18 @@
1
1
 
2
2
  # ######################################################################## #
3
- # File: lib/xqsr3/array_utilities/join_with_or.rb
3
+ # File: lib/xqsr3/array_utilities/join_with_or.rb
4
4
  #
5
- # Purpose: Definition of the ::Xqsr3::ArrayUtilities::JoinWithOr
6
- # module
5
+ # Purpose: Definition of the ::Xqsr3::ArrayUtilities::JoinWithOr module
7
6
  #
8
- # Created: 7th December 2017
9
- # Updated: 12th April 2019
7
+ # Created: 7th December 2017
8
+ # Updated: 29th March 2024
10
9
  #
11
- # Home: http://github.com/synesissoftware/xqsr3
10
+ # Home: http://github.com/synesissoftware/xqsr3
12
11
  #
13
- # Author: Matthew Wilson
12
+ # Author: Matthew Wilson
14
13
  #
15
- # Copyright (c) 2017, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
15
+ # Copyright (c) 2017-2019, 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
@@ -26,7 +26,7 @@
26
26
  # notice, this list of conditions and the following disclaimer in the
27
27
  # documentation and/or other materials provided with the distribution.
28
28
  #
29
- # * Neither the names of the copyright holder nor the names of its
29
+ # * Neither the names of the copyright holders nor the names of its
30
30
  # contributors may be used to endorse or promote products derived from
31
31
  # this software without specific prior written permission.
32
32
  #
@@ -59,50 +59,50 @@ module ArrayUtilities
59
59
  # +include+-able module that provides sequence-joining functionality
60
60
  module JoinWithOr
61
61
 
62
- extend self
63
-
64
- # Joins an array with grammatical appropriateness (with an 'or')
65
- #
66
- # === Signature
67
- #
68
- # * *Parameters:*
69
- # - +ar+ (Array) The array whose contents are to be joined
70
- # - +options+ (Hash) Options that control the behaviour of the method
71
- #
72
- # * *Options:*
73
- # - +:or+ (String) A string that is used instead of 'or'
74
- # - +:oxford_comma+ (boolean) Determines whether an Oxford comma will be used. Default is +true+
75
- # - +:quote_char+ (String) The quote character. Default is empty string ''
76
- # - +:separator+ (String) The separator character. Default is ','
77
- def join_with_or ar, **options
78
-
79
- ::Xqsr3::Quality::ParameterChecking.check_parameter ar, 'ar', type: ::Array, allow_nil: true
80
- ::Xqsr3::Quality::ParameterChecking.check_parameter options, 'options', type: ::Hash, allow_nil: false
81
-
82
- ::Xqsr3::Quality::ParameterChecking.check_parameter options[:or], ':or', type: ::String, option: true, allow_nil: true
83
- ::Xqsr3::Quality::ParameterChecking.check_parameter options[:oxford_comma], ':oxford_comma', types: [ ::FalseClass, ::TrueClass ], option: true, allow_nil: true
84
- ::Xqsr3::Quality::ParameterChecking.check_parameter options[:quote_char], ':quote_char', type: ::String, option: true, allow_nil: true
85
- ::Xqsr3::Quality::ParameterChecking.check_parameter options[:separator], ':separator', type: ::String, option: true, allow_nil: true
86
-
87
- return '' if ar.nil?
88
- return '' if ar.empty?
89
-
90
- separator = options[:separator] || ','
91
- or_word = options[:or] || 'or'
92
- ox_comma = (options.has_key?(:oxford_comma) && !options[:oxford_comma]) ? '' : separator
93
- quote_char = options[:quote_char]
94
-
95
- ar = ar.map { |v| "#{quote_char}#{v}#{quote_char}" } if quote_char
96
-
97
- case ar.size
98
- when 1
99
- ar[0]
100
- when 2
101
- "#{ar[0]} #{or_word} #{ar[1]}"
102
- else
103
- "#{ar[0...-1].join(separator + ' ')}#{ox_comma} #{or_word} #{ar[-1]}"
104
- end
105
- end
62
+ extend self
63
+
64
+ # Joins an array with grammatical appropriateness (with an 'or')
65
+ #
66
+ # === Signature
67
+ #
68
+ # * *Parameters:*
69
+ # - +ar+ (Array) The array whose contents are to be joined
70
+ # - +options+ (Hash) Options that control the behaviour of the method
71
+ #
72
+ # * *Options:*
73
+ # - +:or+ (String) A string that is used instead of 'or'
74
+ # - +:oxford_comma+ (boolean) Determines whether an Oxford comma will be used. Default is +true+
75
+ # - +:quote_char+ (String) The quote character. Default is empty string ''
76
+ # - +:separator+ (String) The separator character. Default is ','
77
+ def join_with_or ar, **options
78
+
79
+ ::Xqsr3::Quality::ParameterChecking.check_parameter ar, 'ar', type: ::Array, allow_nil: true
80
+ ::Xqsr3::Quality::ParameterChecking.check_parameter options, 'options', type: ::Hash, allow_nil: false
81
+
82
+ ::Xqsr3::Quality::ParameterChecking.check_parameter options[:or], ':or', type: ::String, option: true, allow_nil: true
83
+ ::Xqsr3::Quality::ParameterChecking.check_parameter options[:oxford_comma], ':oxford_comma', types: [ ::FalseClass, ::TrueClass ], option: true, allow_nil: true
84
+ ::Xqsr3::Quality::ParameterChecking.check_parameter options[:quote_char], ':quote_char', type: ::String, option: true, allow_nil: true
85
+ ::Xqsr3::Quality::ParameterChecking.check_parameter options[:separator], ':separator', type: ::String, option: true, allow_nil: true
86
+
87
+ return '' if ar.nil?
88
+ return '' if ar.empty?
89
+
90
+ separator = options[:separator] || ','
91
+ or_word = options[:or] || 'or'
92
+ ox_comma = (options.has_key?(:oxford_comma) && !options[:oxford_comma]) ? '' : separator
93
+ quote_char = options[:quote_char]
94
+
95
+ ar = ar.map { |v| "#{quote_char}#{v}#{quote_char}" } if quote_char
96
+
97
+ case ar.size
98
+ when 1
99
+ ar[0]
100
+ when 2
101
+ "#{ar[0]} #{or_word} #{ar[1]}"
102
+ else
103
+ "#{ar[0...-1].join(separator + ' ')}#{ox_comma} #{or_word} #{ar[-1]}"
104
+ end
105
+ end
106
106
 
107
107
  end # module JoinWithOr
108
108
 
@@ -111,4 +111,3 @@ end # module Xqsr3
111
111
 
112
112
  # ############################## end of file ############################# #
113
113
 
114
-
@@ -1,10 +1,10 @@
1
1
 
2
2
  %w{
3
3
 
4
- join_with_or
4
+ join_with_or
5
5
  }.each do |name|
6
6
 
7
- require File.join(File.dirname(__FILE__), 'array_utilities', name)
7
+ require File.join(File.dirname(__FILE__), 'array_utilities', name)
8
8
  end
9
9
 
10
10
 
@@ -1,18 +1,18 @@
1
1
 
2
2
  # ######################################################################## #
3
- # File: lib/xqsr3/command_line_utilities/map_option_string.rb
3
+ # File: lib/xqsr3/command_line_utilities/map_option_string.rb
4
4
  #
5
- # Purpose: Definition of the
6
- # ::Xqsr3::CommandLineUtilities::MapOptionString module
5
+ # Purpose: Definition of the ::Xqsr3::CommandLineUtilities::MapOptionString
6
+ # module
7
7
  #
8
- # Created: 15th April 2016
9
- # Updated: 19th July 2022
8
+ # Created: 15th April 2016
9
+ # Updated: 29th March 2024
10
10
  #
11
- # Home: http://github.com/synesissoftware/xqsr3
11
+ # Home: http://github.com/synesissoftware/xqsr3
12
12
  #
13
- # Author: Matthew Wilson
13
+ # Author: Matthew Wilson
14
14
  #
15
- # Copyright (c) 2019-2022, Matthew Wilson and Synesis Information Systems
15
+ # Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
16
16
  # Copyright (c) 2016-2019, Matthew Wilson and Synesis Software
17
17
  # All rights reserved.
18
18
  #
@@ -27,7 +27,7 @@
27
27
  # notice, this list of conditions and the following disclaimer in the
28
28
  # documentation and/or other materials provided with the distribution.
29
29
  #
30
- # * Neither the names of the copyright holder nor the names of its
30
+ # * Neither the names of the copyright holders nor the names of its
31
31
  # contributors may be used to endorse or promote products derived from
32
32
  # this software without specific prior written permission.
33
33
  #
@@ -64,85 +64,85 @@ module CommandLineUtilities
64
64
  # * ::Xqsr3::CommandLineUtilities::MapOptionString#map_option_string
65
65
  module MapOptionString
66
66
 
67
- def self.included includer # :nodoc:
67
+ def self.included includer # :nodoc:
68
68
 
69
- raise TypeError, "module #{self} cannot be included into #{includer} because it does not respond to to_str" unless includer.method_defined? :to_str
70
- end
69
+ raise TypeError, "module #{self} cannot be included into #{includer} because it does not respond to to_str" unless includer.method_defined? :to_str
70
+ end
71
71
 
72
- private
73
- # @!visibility private
74
- module MapOptionString_Helper_ # :nodoc: all
72
+ private
73
+ # @!visibility private
74
+ module MapOptionString_Helper_ # :nodoc: all
75
75
 
76
- def self.map_option_string_with_options_ s, option_strings, options
76
+ def self.map_option_string_with_options_ s, option_strings, options
77
77
 
78
- h = {}
78
+ h = {}
79
79
 
80
- option_strings.each do |os|
80
+ option_strings.each do |os|
81
81
 
82
- t = os.dup
83
- v = os.dup
82
+ t = os.dup
83
+ v = os.dup
84
84
 
85
- if t =~ /\[.+?\]/
85
+ if t =~ /\[.+?\]/
86
86
 
87
- k = ''
88
- v = ''
87
+ k = ''
88
+ v = ''
89
89
 
90
- while t =~ /\[(.+?)\]/
90
+ while t =~ /\[(.+?)\]/
91
91
 
92
- k += $1
93
- v += "#$`#$1"
94
- t = $'
95
- end
92
+ k += $1
93
+ v += "#$`#$1"
94
+ t = $'
95
+ end
96
96
 
97
- v += t
98
- else
97
+ v += t
98
+ else
99
99
 
100
- k = v
101
- end
100
+ k = v
101
+ end
102
102
 
103
- h[k] = v
104
- h[v] = v
105
- end
103
+ h[k] = v
104
+ h[v] = v
105
+ end
106
106
 
107
- r = h[s]
107
+ r = h[s]
108
108
 
109
- if r
109
+ if r
110
110
 
111
- r = ::Xqsr3::StringUtilities::ToSymbol.string_to_symbol r
112
- end
111
+ r = ::Xqsr3::StringUtilities::ToSymbol.string_to_symbol r
112
+ end
113
113
 
114
- r
115
- end
116
- end
117
- public
114
+ r
115
+ end
116
+ end
117
+ public
118
118
 
119
- # Attempts to translate the value of a given string according
120
- # to a collection of options strings
121
- #
122
- # === Signature
123
- #
124
- # * *Parameters:*
125
- # - +s+ (::String) The string to be mapped
126
- # - +option_strings+ ([::String]) An array of strings against which the mapping will be performed
127
- # - +options+ (Hash) Options that control the behaviour of the method
128
- def self.map_option_string_from_string s, option_strings, options = {}
119
+ # Attempts to translate the value of a given string according
120
+ # to a collection of options strings
121
+ #
122
+ # === Signature
123
+ #
124
+ # * *Parameters:*
125
+ # - +s+ (::String) The string to be mapped
126
+ # - +option_strings+ ([::String]) An array of strings against which the mapping will be performed
127
+ # - +options+ (Hash) Options that control the behaviour of the method
128
+ def self.map_option_string_from_string s, option_strings, options = {}
129
129
 
130
- MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
131
- end
130
+ MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
131
+ end
132
132
 
133
- # Attempts to translate the (string) value of the receiver according
134
- # to a collection of options strings
135
- #
136
- # === Signature
137
- #
138
- # * *Parameters:*
139
- # - +option_strings+ ([::String]) An array of strings against which the mapping will be performed
140
- def map_option_string option_strings, options = {}
133
+ # Attempts to translate the (string) value of the receiver according
134
+ # to a collection of options strings
135
+ #
136
+ # === Signature
137
+ #
138
+ # * *Parameters:*
139
+ # - +option_strings+ ([::String]) An array of strings against which the mapping will be performed
140
+ def map_option_string option_strings, options = {}
141
141
 
142
- s = self.kind_of?(::String) ? self : self.to_str
142
+ s = self.kind_of?(::String) ? self : self.to_str
143
143
 
144
- MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
145
- end
144
+ MapOptionString_Helper_.map_option_string_with_options_ s, option_strings, options
145
+ end
146
146
  end # module MapOptionString
147
147
 
148
148
  end # module CommandLineUtilities
@@ -150,4 +150,3 @@ end # module Xqsr3
150
150
 
151
151
  # ############################## end of file ############################# #
152
152
 
153
-
@@ -1,10 +1,10 @@
1
1
 
2
2
  %w{
3
3
 
4
- map_option_string
4
+ map_option_string
5
5
  }.each do |name|
6
6
 
7
- require File.join(File.dirname(__FILE__), 'command_line_utilities', name)
7
+ require File.join(File.dirname(__FILE__), 'command_line_utilities', name)
8
8
  end
9
9
 
10
10