Sha256: 1cf2667bb9ab579cddf16914549f1c02159a3a71ff8e5869beef1e78b2eb9b24

Contents?: true

Size: 331 Bytes

Versions: 2

Compression:

Stored size: 331 Bytes

Contents

# frozen_string_literal: true

class Serega
  class CheckOptIsBool
    def self.call(opts, key)
      return unless opts.key?(key)

      value = opts[key]
      return if value.equal?(true) || value.equal?(false)

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
serega-0.1.1 lib/serega/validations/check_opt_is_bool.rb
serega-0.1.0 lib/serega/validations/check_opt_is_bool.rb