Sha256: 0bb724ebee2f0db158a1f34e682d142d55c340dc7c2cf1399f1cfc979456322c

Contents?: true

Size: 400 Bytes

Versions: 7

Compression:

Stored size: 400 Bytes

Contents

# frozen_string_literal: true

class Serega
  module SeregaValidations
    module Utils
      class CheckOptIsHash
        def self.call(opts, key)
          return unless opts.key?(key)

          value = opts[key]
          return if value.is_a?(Hash)

          raise SeregaError, "Invalid option #{key.inspect} => #{value.inspect}. Must have a Hash value"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
serega-0.6.1 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.6.0 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.5.2 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.5.1 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.5.0 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.4.0 lib/serega/validations/utils/check_opt_is_hash.rb
serega-0.3.0 lib/serega/validations/utils/check_opt_is_hash.rb