Module: Xqsr3::Quality::ParameterChecking
- Defined in:
- lib/xqsr3/quality/parameter_checking.rb
Overview
Inclusion module that creates class and instance methods check_parameter
that may be used to check parameter values and types
Class Method Summary collapse
-
.check_param(value, name, options = {}, &block) ⇒ Object
Please use
check_parameter
instead. -
.check_parameter(value, name, options = {}, &block) ⇒ Object
Check a given parameter (value=
value
, name=name
) for type and value. -
.included(base) ⇒ Object
:nodoc:.
Class Method Details
.check_param(value, name, options = {}, &block) ⇒ Object
This is obsolete, and will be removed in a future version.
Please use check_parameter
instead
197 198 199 200 |
# File 'lib/xqsr3/quality/parameter_checking.rb', line 197 def self.check_param value, name, = {}, &block Util_.check_parameter value, name, , &block end |
.check_parameter(value, name, options = {}, &block) ⇒ Object
Check a given parameter (value=value
, name=name
) for type and value
Signature
-
Parameters:
-
value
the parameter whose value and type is to be checked -
name
the name of the parameter to be checked -
options
options
-
-
Options:
-
:allow_nil
(boolean) Thevalue
must not benil
unless this option is true -
:nil
an alias for:allow_nil
-
:ignore_case
(boolean) When:values
is specified, comparisons of strings, or arrays of strings, will be carried out in a case-insensitive manner -
:types
(::Array) An array of types one of whichvalue
must be (or must be derived from). One of these types may be an array of types, in which casevalue
may be an array that must consist wholly of those types -
:type
(::Class) A single type parameter, used only if:types
is not specified -
:values
(::Array) an array of values one of whichvalue
must be -
:responds_to
(::Array) An array of symbols specifying all messages to which the parameter will respond -
:reject_empty
(boolean) requires value to respond toempty?
message and to do so with false, unlessnil
-
:require_empty
(boolean) requires value to respond toempty?
message and to do so with true, unlessnil
-
:nothrow
(boolean) causes failure to be indicated by anil
return rather than a thrown exception -
:message
(boolean) specifies a message to be used in any thrown exception, which suppresses internal message preparation -
:treat_as_option
(boolean) If true, the value will be treated as an option when reporting check failure
-
188 189 190 191 |
# File 'lib/xqsr3/quality/parameter_checking.rb', line 188 def self.check_parameter value, name, = {}, &block Util_.check_parameter value, name, , &block end |
.included(base) ⇒ Object
:nodoc:
103 104 105 106 |
# File 'lib/xqsr3/quality/parameter_checking.rb', line 103 def self.included base # :nodoc: base.extend self end |