xqsr3 0.32.2 → 0.32.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xqsr3/array_utilities/join_with_or.rb +7 -14
  3. data/lib/xqsr3/command_line_utilities/map_option_string.rb +19 -7
  4. data/lib/xqsr3/containers/frequency_map.rb +1 -1
  5. data/lib/xqsr3/containers/multi_map.rb +28 -0
  6. data/lib/xqsr3/conversion/bool_parser.rb +11 -14
  7. data/lib/xqsr3/conversion/integer_parser.rb +7 -14
  8. data/lib/xqsr3/diagnostics/exception_utilities.rb +2 -2
  9. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +15 -7
  10. data/lib/xqsr3/diagnostics/inspect_builder.rb +11 -15
  11. data/lib/xqsr3/doc_.rb +138 -9
  12. data/lib/xqsr3/extensions/array/join_with_or.rb +6 -0
  13. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +5 -4
  14. data/lib/xqsr3/extensions/enumerable/detect_map.rb +6 -7
  15. data/lib/xqsr3/extensions/hash/has_match.rb +7 -0
  16. data/lib/xqsr3/extensions/hash/match.rb +7 -0
  17. data/lib/xqsr3/extensions/kernel/integer.rb +6 -13
  18. data/lib/xqsr3/extensions/string/to_bool.rb +4 -0
  19. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +1 -0
  20. data/lib/xqsr3/extensions/test/unit/assert_false.rb +1 -0
  21. data/lib/xqsr3/extensions/test/unit/assert_not.rb +1 -0
  22. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +1 -0
  23. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +5 -2
  24. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +1 -0
  25. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +1 -0
  26. data/lib/xqsr3/extensions/test/unit/assert_true.rb +1 -0
  27. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +3 -12
  28. data/lib/xqsr3/hash_utilities/deep_transform.rb +2 -2
  29. data/lib/xqsr3/internal_/test_unit_version_.rb +4 -4
  30. data/lib/xqsr3/io/writelines.rb +6 -6
  31. data/lib/xqsr3/quality/parameter_checking.rb +50 -77
  32. data/lib/xqsr3/string_utilities/ends_with.rb +14 -6
  33. data/lib/xqsr3/string_utilities/nil_if_empty.rb +6 -3
  34. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +7 -3
  35. data/lib/xqsr3/string_utilities/quote_if.rb +10 -13
  36. data/lib/xqsr3/string_utilities/starts_with.rb +22 -5
  37. data/lib/xqsr3/string_utilities/to_symbol.rb +23 -5
  38. data/lib/xqsr3/string_utilities/truncate.rb +19 -4
  39. data/lib/xqsr3/version.rb +1 -1
  40. metadata +1 -1
@@ -3,6 +3,12 @@ require 'xqsr3/array_utilities/join_with_or'
3
3
 
4
4
  class Array
5
5
 
6
+ # Extended method implemented by JoinWithOr
7
+ #
8
+ # === Signature
9
+ #
10
+ # * *Parameters:*
11
+ # - +options+ (Hash) See Xqsr3::ArrayUtilities
6
12
  def join_with_or **options
7
13
 
8
14
  return ::Xqsr3::ArrayUtilities::JoinWithOr.join_with_or self, **options
@@ -5,13 +5,13 @@
5
5
  # Purpose: Adds a collect_with_index() method to the Enumerable module
6
6
  #
7
7
  # Created: 24th October 2010
8
- # Updated: 4th April 2016
8
+ # Updated: 12th April 2019
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2010-2016, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2010-2019, 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
@@ -52,8 +52,9 @@
52
52
 
53
53
  module Enumerable
54
54
 
55
- ## Two-parameter #collect, where the second parameter is a #base-based
56
- # index, which increments by 1 for each enumerated element.
55
+ # Two-parameter variant of +Enumerable+#+collect+, where the second
56
+ # parameter is a +base+-based index, which increments by 1 for each
57
+ # enumerated element.
57
58
  def collect_with_index(base = 0)
58
59
 
59
60
  a = []
@@ -5,13 +5,13 @@
5
5
  # Purpose: ::Enumerable#detect_map extension
6
6
  #
7
7
  # Created: 3rd December 2017
8
- # Updated: 9th December 2017
8
+ # Updated: 12th April 2019
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-2019, 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
@@ -49,15 +49,15 @@
49
49
 
50
50
  module Enumerable
51
51
 
52
- # The +Enumerable#detect+ method provides a way to detect the presence
52
+ # The +Enumerable+#+detect+ method provides a way to detect the presence
53
53
  # of a particular value in a collection. The only constraint is that you
54
54
  # get back the object unchanged.
55
55
  #
56
- # The +Enumerable#map+ method provides a way to transform the contents of
56
+ # The +Enumerable+#+map+ method provides a way to transform the contents of
57
57
  # a collection. The only constraint is that you get back another
58
58
  # collection.
59
59
  #
60
- # This extension method, +Enumerable#detect_map+ combines the features
60
+ # This extension method, +Enumerable+#+detect_map+ combines the features
61
61
  # of both, in that it detects the presence of a particular value in a
62
62
  # collection and transform the detected value.
63
63
  #
@@ -65,7 +65,7 @@ module Enumerable
65
65
  #
66
66
  # { :ab => 'cd', :ef => 'gh' }.detect_map { |k, v| v.upcase if k == :ef } # => 'GH'
67
67
  #
68
- # @note The block is required (for technical reasons), and must have
68
+ # *Note:* The block is required (for technical reasons), and must have
69
69
  # arity 1 for sequences or 2 for associations
70
70
  def detect_map &block
71
71
 
@@ -89,7 +89,6 @@ module Enumerable
89
89
 
90
90
  nil
91
91
  end
92
-
93
92
  end # module Enumerable
94
93
 
95
94
  # ############################## end of file ############################# #
@@ -3,6 +3,13 @@ require 'xqsr3/hash_utilities/key_matching'
3
3
 
4
4
  class Hash
5
5
 
6
+ # Extended method implemented by Xqsr3::HashUtilities::KeyMatching
7
+ #
8
+ # === Signature
9
+ #
10
+ # * *Parameters:*
11
+ # - +re+ (Regexp) The regular expression
12
+ # - +options+ (Hash) See Xqsr3::HashUtilities::KeyMatching
6
13
  def has_match? re, **options
7
14
 
8
15
  return ::Xqsr3::HashUtilities::KeyMatching.has_match? self, re, **options
@@ -3,6 +3,13 @@ require 'xqsr3/hash_utilities/key_matching'
3
3
 
4
4
  class Hash
5
5
 
6
+ # Extended method implemented by Xqsr3::HashUtilities::KeyMatching
7
+ #
8
+ # === Signature
9
+ #
10
+ # * *Parameters:*
11
+ # - +re+ (Regexp) The regular expression
12
+ # - +options+ (Hash) See Xqsr3::HashUtilities::KeyMatching
6
13
  def match re, **options
7
14
 
8
15
  return ::Xqsr3::HashUtilities::KeyMatching.match self, re, **options
@@ -61,21 +61,14 @@ module Kernel
61
61
  # === Signature
62
62
  #
63
63
  # * *Parameters:*
64
- # - +arg+:: The argument to be converted (to +Fixnum+ or +Bignum+)
65
- # - +base+:: A value of 0, or between 2 and 36. Defaults to 0
66
- # - +options+:: An options hash, containing any of the following
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
64
+ # - +arg+ The argument to be converted (to +Fixnum+ or +Bignum+)
65
+ # - +base+ A value of 0, or between 2 and 36. Defaults to 0
66
+ # - +options+ An options hash, containing any of the following options
67
+ # - +block+ An optional caller-supplied block that will be invoked with the +ArgumentError+ exception, allowing the caller to take additional action. If the block returns then its return value will be returned to the caller
72
68
  #
73
69
  # * *Options:*
74
- # - +:default+:: A default value to be used when +arg+ is +nil+ or
75
- # cannot be converted by (the original) +Kernel#Integer+
76
- # - +:nil+:: Returns +nil+ if +arg+ is +nil+ or cannot be
77
- # converted by (the original) +Kernel#Integer+. Ignored if
78
- # +:default+ is specified
70
+ # - +:default+ A default value to be used when +arg+ is +nil+ or cannot be converted by (the original) +Kernel#Integer+
71
+ # - +:nil+ Returns +nil+ if +arg+ is +nil+ or cannot be converted by (the original) +Kernel#Integer+. Ignored if +:default+ is specified
79
72
  def Integer(arg, base = 0, **options, &block)
80
73
 
81
74
  ::Xqsr3::Conversion::IntegerParser.to_integer arg, base = 0, **options, &block
@@ -3,6 +3,10 @@ require 'xqsr3/conversion/bool_parser'
3
3
 
4
4
  class String
5
5
 
6
+ # Attempts to convert instance to a Boolean value, based on the given
7
+ # +options+
8
+ #
9
+ # See Xqsr3::Conversion::BoolParser
6
10
  def to_bool **options
7
11
 
8
12
  return ::Xqsr3::Conversion::BoolParser.to_bool self, **options
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_eql
8
8
 
9
+ # Assert that +expected+ and +actual+ have the same hash key
9
10
  def assert_eql(expected, actual, failure_message = '')
10
11
 
11
12
  assert expected.eql?(actual), failure_message
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_false
8
8
 
9
+ # Assert that +expression+ is +false+
9
10
  def assert_false(expression, failure_message = '')
10
11
 
11
12
  assert ::FalseClass === (expression), failure_message
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_not
8
8
 
9
+ # Assert that +expression+ is _falsey_
9
10
  def assert_not(expression, failure_message = '')
10
11
 
11
12
  assert !(expression), failure_message
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_not_eql
8
8
 
9
+ # Assert that +expected+ and +actual+ have different hash keys
9
10
  def assert_not_eql(expected, actual, failure_message = '')
10
11
 
11
12
  assert !(expected.eql?(actual)), failure_message
@@ -7,10 +7,10 @@ module X_assert_raise_with_message_ # :nodoc:
7
7
 
8
8
  if TestUnitVersion_.is_at_least? [ 3, 0, 8 ]
9
9
 
10
- AssertionFailedError_ = Test::Unit::AssertionFailedError
10
+ AssertionFailedError_ = Test::Unit::AssertionFailedError # :nodoc:
11
11
  else
12
12
 
13
- class AssertionFailedError_ < ArgumentError; end
13
+ class AssertionFailedError_ < ArgumentError; end # :nodoc:
14
14
  end
15
15
 
16
16
  end # module X_assert_raise_with_message_
@@ -24,6 +24,9 @@ module Assertions
24
24
 
25
25
  undef :assert_raise_with_message if respond_to? :assert_raise_with_message
26
26
 
27
+ # Asserts that the attached block raises an exception of one of the
28
+ # exceptions defined by +type_spec+ and/or has a message matching
29
+ # +message_spec+
27
30
  def assert_raise_with_message(type_spec, message_spec, failure_message = nil, &block)
28
31
 
29
32
  unless block_given?
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_subclass_of
8
8
 
9
+ # Assert that +tested_class+ is a sub-class of +parent_class+
9
10
  def assert_subclass_of(parent_class, tested_class, failure_message = nil)
10
11
 
11
12
  failure_message ||= "#{tested_class} is not a subclass of #{parent_class}"
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_superclass_of
8
8
 
9
+ # Assert that +tested_class+ is a super-class of +child_class+
9
10
  def assert_superclass_of(child_class, tested_class, failure_message = nil)
10
11
 
11
12
  failure_message ||= "#{tested_class} is not a superclass of #{child_class}"
@@ -6,6 +6,7 @@ module Assertions
6
6
 
7
7
  unless respond_to? :assert_true
8
8
 
9
+ # Assert that +expression+ is +true+
9
10
  def assert_true(expression, failure_message = '')
10
11
 
11
12
  assert ::TrueClass === (expression), failure_message
@@ -12,18 +12,9 @@ module Assertions
12
12
  # === Signature
13
13
  #
14
14
  # * *Parameters:*
15
- # - +type+:: [::Class] The type
16
- # - +message_spec+:: [::Symbol, ::Array, ::Hash] A specification
17
- # of message(s) received by the instances of +type+. If a
18
- # ::Symbol, then instances must respond to this single message.
19
- # If an ::Array (all elements of which must be ::Symbol), then
20
- # instances must respond to _all_ messages. If a ::Hash, then
21
- # instances must respond to _all_ messages represented by the
22
- # keys; the values are available for specifying a custom failure
23
- # message (or value is +nil+ for stock message)
24
- # - +failure_message+:: [::String] If specified, is used when
25
- # instances of +type+ do not respond to a message and no custom
26
- # failure message is provided for it
15
+ # - +type+ (::Class) The type
16
+ # - +message_spec+ (::Symbol, ::Array, ::Hash) A specification of message(s) received by the instances of +type+. If a ::Symbol, then instances must respond to this single message. If an ::Array (all elements of which must be ::Symbol), then instances must respond to _all_ messages. If a ::Hash, then instances must respond to _all_ messages represented by the keys; the values are available for specifying a custom failure message (or value is +nil+ for stock message)
17
+ # - +failure_message+ (::String) If specified, is used when instances of +type+ do not respond to a message and no custom failure message is provided for it
27
18
  def assert_type_has_instance_methods(type, message_spec, failure_message = nil)
28
19
 
29
20
  warn "type parameter - '#{type} (#{type.class})' - should be a Class" unless type.is_a?(::Class)
@@ -59,7 +59,7 @@ module HashUtilities
59
59
  module DeepTransform
60
60
 
61
61
  private
62
- def self.do_deep_transform_on_hashlike_ h, &block
62
+ def self.do_deep_transform_on_hashlike_ h, &block # :nodoc:
63
63
 
64
64
  ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :map ]
65
65
 
@@ -92,7 +92,7 @@ module DeepTransform
92
92
  h
93
93
  end
94
94
 
95
- def do_deep_transform_on_self_ &block
95
+ def do_deep_transform_on_self_ &block # :nodoc:
96
96
 
97
97
  ::Xqsr3::Quality::ParameterChecking.check_parameter h, 'h', responds_to: [ :[]=, :delete, :keys ]
98
98
 
@@ -8,8 +8,8 @@ begin
8
8
  require 'test/unit/version'
9
9
 
10
10
  module Xqsr3
11
- module Internal_
12
- module TestUnitVersion_
11
+ module Internal_ # :nodoc:
12
+ module TestUnitVersion_ # :nodoc:
13
13
 
14
14
  TEST_UNIT_VERSION_ = Test::Unit::VERSION # :nodoc:
15
15
  end # module TestUnitVersion_
@@ -18,8 +18,8 @@ begin
18
18
  rescue LoadError
19
19
 
20
20
  module Xqsr3
21
- module Internal_
22
- module TestUnitVersion_
21
+ module Internal_ # :nodoc:
22
+ module TestUnitVersion_ # :nodoc:
23
23
 
24
24
  TEST_UNIT_VERSION_ = :not_found # :nodoc:
25
25
  end # module TestUnitVersion_
@@ -126,14 +126,14 @@ $stderr.puts "#{self.class}.write_to_target_(target(#{target.class})='#{target}'
126
126
  # === Signature
127
127
  #
128
128
  # * *Parameters:*
129
- # - +target+:: The target of the write, which may be a string containing the path or a stream instance that supports write
130
- # - +contents+:: The contents to be write, which may be a +Hash+, or an +Array+, or a +String+ containing delimited fields
131
- # - +options+:: An options hash, containing any of the following options
129
+ # - +target+ The target of the write, which may be a string containing the path or a stream instance that supports write
130
+ # - +contents+ The contents to be write, which may be a +Hash+, or an +Array+, or a +String+ containing delimited fields
131
+ # - +options+ An options hash, containing any of the following options
132
132
  #
133
133
  # * *Options:*
134
- # - +:column_separator+:: {optional} The column separator, to be applied between each field in the case where +contents+ is a +Hash+.
135
- # - +:eol_lookahead_limit+:: {optional} The number of content elements (line/pair) to inspect to determine whether element has a terminating end-of-line sequence. Defaults to 20. If 0, and +:line_separator+ is not specified, then will default to <tt>"\n"</tt>. If +nil+, then every line will be inspected.
136
- # - +:line_separator+:: {optional} The line separator, to be applied to the end of line created from each entry. When not specified, it will be deduced by inspecting +contents+ (according to +eol_lookahead_limit+).
134
+ # - +:column_separator+ {optional} The column separator, to be applied between each field in the case where +contents+ is a +Hash+.
135
+ # - +:eol_lookahead_limit+ {optional} The number of content elements (line/pair) to inspect to determine whether element has a terminating end-of-line sequence. Defaults to 20. If 0, and +:line_separator+ is not specified, then will default to <tt>"\n"</tt>. If +nil+, then every line will be inspected.
136
+ # - +:line_separator+ {optional} The line separator, to be applied to the end of line created from each entry. When not specified, it will be deduced by inspecting +contents+ (according to +eol_lookahead_limit+).
137
137
  #
138
138
  # === Return
139
139
  #
@@ -5,13 +5,13 @@
5
5
  # Purpose: Definition of the ParameterChecking module
6
6
  #
7
7
  # Created: 12th February 2015
8
- # Updated: 18th October 2018
8
+ # Updated: 12th April 2019
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2015-2018, Matthew Wilson and Synesis Software
14
+ # Copyright (c) 2015-2019, 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
@@ -76,7 +76,7 @@ module ParameterChecking
76
76
  end
77
77
  end
78
78
 
79
- module Constants
79
+ module Constants # :nodoc:
80
80
 
81
81
  RECOGNISED_OPTION_NAMES = %w{
82
82
 
@@ -99,7 +99,7 @@ module ParameterChecking
99
99
  end # module Util_
100
100
  public
101
101
 
102
- def self.included base
102
+ def self.included base # :nodoc:
103
103
 
104
104
  base.extend self
105
105
  end
@@ -107,42 +107,27 @@ module ParameterChecking
107
107
  private
108
108
  # Check a given parameter (value=+value+, name=+name+) for type and value
109
109
  #
110
- # @param +value+:: the parameter whose value and type is to be checked
111
- # @param +name+:: (::String, ::Symbol) the name of the parameter to be
112
- # checked
113
- # @param +options+:: (::Hash) options that moderate the behaviour
110
+ # === Signature
114
111
  #
115
- # @option +:allow_nil+:: (boolean) The +value+ must not be +nil+ unless
116
- # this option is true
117
- # @option +:nil+:: an alias for +:allow_nil+
118
- # @option +:ignore_case+:: (boolean) When +:values+ is specified,
119
- # comparisons of strings, or arrays of strings, will be carried out in
120
- # a case-insensitive manner
121
- # @option +:types+:: (::Array) An array of types one of which +value+
122
- # must be (or must be derived from). One of these types may be
123
- # an array of types, in which case +value+ may be an array that
124
- # must consist wholly of those types
125
- # @option +:type+:: (::Class) A single type parameter, used only if
126
- # +:types+ is not specified
127
- # @option +:values+:: (::Array) an array of values one of which +value+
128
- # must be
129
- # @option +:responds_to+:: (::Array) An array of symbols specifying all
130
- # messages to which the parameter will respond
131
- # @option +:reject_empty+:: (boolean) requires value to respond to
132
- # +empty?+ message and to do so with false, unless +nil+
133
- # @option +:require_empty+:: (boolean) requires value to respond to
134
- # +empty?+ message and to do so with true, unless +nil+
135
- # @option +:nothrow+:: (boolean) causes failure to be indicated by a
136
- # +nil+ return rather than a thrown exception
137
- # @option +:message+:: (::String) specifies a message to be used in any
138
- # thrown exception, which suppresses internal message
139
- # preparation
140
- # @option +:strip_str_whitespace+:: (boolean) If +value+ is a string (as
141
- # determined by responding to +to_str+ message), then it will
142
- # be stripped - leading and trailing whitespace removed -
143
- # before any processing
144
- # @option +:treat_as_option+:: (boolean) If true, the value will be
145
- # treated as an option when reporting check failure
112
+ # * *Parameters:*
113
+ # - +value+ the parameter whose value and type is to be checked
114
+ # - +name+ (::String, ::Symbol) the name of the parameter to be checked
115
+ # - +options+ (::Hash) options that moderate the behaviour
116
+ #
117
+ # * *Options:*
118
+ # - +:allow_nil+ (boolean) The +value+ must not be +nil+ unless this option is true
119
+ # - +:nil+ an alias for +:allow_nil+
120
+ # - +:ignore_case+ (boolean) When +:values+ is specified, comparisons of strings, or arrays of strings, will be carried out in a case-insensitive manner
121
+ # - +:types+ (::Array) An array of types one of which +value+ must be (or must be derived from). One of these types may be an array of types, in which case +value+ may be an array that must consist wholly of those types
122
+ # - +:type+ (::Class) A single type parameter, used only if +:types+ is not specified
123
+ # - +:values+ (::Array) an array of values one of which +value+ must be
124
+ # - +:responds_to+ (::Array) An array of symbols specifying all messages to which the parameter will respond
125
+ # - +:reject_empty+ (boolean) requires value to respond to +empty?+ message and to do so with false, unless +nil+
126
+ # - +:require_empty+ (boolean) requires value to respond to +empty?+ message and to do so with true, unless +nil+
127
+ # - +:nothrow+ (boolean) causes failure to be indicated by a +nil+ return rather than a thrown exception
128
+ # - +:message+ (::String) specifies a message to be used in any thrown exception, which suppresses internal message preparation
129
+ # - +:strip_str_whitespace+ (boolean) If +value+ is a string (as determined by responding to +to_str+ message), then it will be stripped - leading and trailing whitespace removed - before any processing
130
+ # - +:treat_as_option+ (boolean) If true, the value will be treated as an option when reporting check failure
146
131
  #
147
132
  # This method is private, because it should only be used within methods
148
133
  def check_parameter value, name, options = {}, &block
@@ -162,15 +147,14 @@ module ParameterChecking
162
147
  # Specific form of the +check_parameter()+ that is used to check
163
148
  # options, taking instead the hash and the key
164
149
  #
165
- # @param +h+:: (::Hash) The options hash from which the named element is
166
- # to be tested. May not be +nil+
167
- # @param +name+:: (::String, ::Symbol, [ ::String, ::Symbol ]) The
168
- # options key name, or an array of names. May not be +nil+
169
- # @param +options+:: (::Hash) options that moderate the behaviour in the
170
- # same way as for +check_parameter()+ except that the
171
- # +:treat_as_option+ option (with the value +true+) is merged in
172
- # before calling +check_parameter()+
150
+ # === Signature
151
+ #
152
+ # * *Parameters:*
153
+ # - +h+ (::Hash) The options hash from which the named element is to be tested. May not be +nil+
154
+ # - +name+ (::String, ::Symbol, [ ::String, ::Symbol ]) The options key name, or an array of names. May not be +nil+
155
+ # - +options+ (::Hash) options that moderate the behaviour in the same way as for +check_parameter()+ except that the +:treat_as_option+ option (with the value +true+) is merged in before calling +check_parameter()+
173
156
  #
157
+ # * *Options:*
174
158
  def check_option h, name, options = {}, &block
175
159
 
176
160
  Util_.check_option h, name, options, &block
@@ -179,37 +163,26 @@ module ParameterChecking
179
163
  public
180
164
  # Check a given parameter (value=+value+, name=+name+) for type and value
181
165
  #
182
- # @param +value+:: the parameter whose value and type is to be checked
183
- # @param +name+:: the name of the parameter to be checked
184
- # @param +options+:: options
166
+ # === Signature
167
+ #
168
+ # * *Parameters:*
169
+ # - +value+ the parameter whose value and type is to be checked
170
+ # - +name+ the name of the parameter to be checked
171
+ # - +options+ options
185
172
  #
186
- # @option +:allow_nil+:: (boolean) The +value+ must not be +nil+ unless
187
- # this option is true
188
- # @option +:nil+:: an alias for +:allow_nil+
189
- # @option +:ignore_case+:: (boolean) When +:values+ is specified,
190
- # comparisons of strings, or arrays of strings, will be carried out in
191
- # a case-insensitive manner
192
- # @option +:types+:: (::Array) An array of types one of which +value+ must
193
- # be (or must be derived from). One of these types may be an
194
- # array of types, in which case +value+ may be an array that
195
- # must consist wholly of those types
196
- # @option +:type+:: (::Class) A single type parameter, used only if
197
- # +:types+ is not specified
198
- # @option +:values+:: (::Array) an array of values one of which +value+
199
- # must be
200
- # @option +:responds_to+:: (::Array) An array of symbols specifying all
201
- # messages to which the parameter will respond
202
- # @option +:reject_empty+:: (boolean) requires value to respond to +empty?+
203
- # message and to do so with false, unless +nil+
204
- # @option +:require_empty+:: (boolean) requires value to respond to
205
- # +empty?+ message and to do so with true, unless +nil+
206
- # @option +:nothrow+:: (boolean) causes failure to be indicated by a +nil+
207
- # return rather than a thrown exception
208
- # @option +:message+:: (boolean) specifies a message to be used in any
209
- # thrown exception, which suppresses internal message
210
- # preparation
211
- # @option +:treat_as_option+:: (boolean) If true, the value will be
212
- # treated as an option when reporting check failure
173
+ # * *Options:*
174
+ # - +:allow_nil+ (boolean) The +value+ must not be +nil+ unless this option is true
175
+ # - +:nil+ an alias for +:allow_nil+
176
+ # - +:ignore_case+ (boolean) When +:values+ is specified, comparisons of strings, or arrays of strings, will be carried out in a case-insensitive manner
177
+ # - +:types+ (::Array) An array of types one of which +value+ must be (or must be derived from). One of these types may be an array of types, in which case +value+ may be an array that must consist wholly of those types
178
+ # - +:type+ (::Class) A single type parameter, used only if +:types+ is not specified
179
+ # - +:values+ (::Array) an array of values one of which +value+ must be
180
+ # - +:responds_to+ (::Array) An array of symbols specifying all messages to which the parameter will respond
181
+ # - +:reject_empty+ (boolean) requires value to respond to +empty?+ message and to do so with false, unless +nil+
182
+ # - +:require_empty+ (boolean) requires value to respond to +empty?+ message and to do so with true, unless +nil+
183
+ # - +:nothrow+ (boolean) causes failure to be indicated by a +nil+ return rather than a thrown exception
184
+ # - +:message+ (boolean) specifies a message to be used in any thrown exception, which suppresses internal message preparation
185
+ # - +:treat_as_option+ (boolean) If true, the value will be treated as an option when reporting check failure
213
186
  #
214
187
  def self.check_parameter value, name, options = {}, &block
215
188