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

Class Method Details

.check_param(value, name, options = {}, &block) ⇒ Object

Note:

This is obsolete, and will be removed in a future version.

Please use check_parameter instead

See Also:



197
198
199
200
# File 'lib/xqsr3/quality/parameter_checking.rb', line 197

def self.check_param value, name, options = {}, &block

	Util_.check_parameter value, name, options, &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) The value must not be nil 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 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

    • :type (::Class) A single type parameter, used only if :types is not specified

    • :values (::Array) an array of values one of which value 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 to empty? message and to do so with false, unless nil

    • :require_empty (boolean) requires value to respond to empty? message and to do so with true, unless nil

    • :nothrow (boolean) causes failure to be indicated by a nil 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, options = {}, &block

	Util_.check_parameter value, name, options, &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