Sha256: 6c92c61b9c3510e41c864a53c8bf52acc235f90f811c7ef7e6c01327210379d3
Contents?: true
Size: 774 Bytes
Versions: 20
Compression:
Stored size: 774 Bytes
Contents
# frozen_string_literal: true class Serega module SeregaValidations module Utils # # Utility to check hash key value is boolean # class CheckOptIsBool # Checks hash key has boolean value # # @param opts [Hash] Some options Hash # @param key [Object] Hash key # # @raise [Serega::SeregaError] error when provided key exists and value is not boolean # # @return [void] def self.call(opts, key) return unless opts.key?(key) value = opts[key] return if value.equal?(true) || value.equal?(false) raise SeregaError, "Invalid option #{key.inspect} => #{value.inspect}. Must have a boolean value" end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems