Module: OCG::Validation
- Defined in:
- lib/ocg/validation.rb
Overview
OCG::Validation module.
Class Method Summary collapse
-
.validate_options(options) ⇒ Object
Raises error when
options
is not hash and option values are not convertable to array and option values are not empty.
Class Method Details
.validate_options(options) ⇒ Object
Raises error when options
is not hash
and option values are not convertable to array
and option values are not empty.
12 13 14 15 16 17 18 19 |
# File 'lib/ocg/validation.rb', line 12 def self.() raise ValidateError, "invalid options hash" unless .is_a? ::Hash .each do |_name, values| raise ValidateError, "option values should respond to \"to_a\"" unless values.respond_to? :to_a raise ValidateError, "option values should not be empty" if values.to_a.empty? end end |