Sha256: 56f0c8d4fb9689eb4829c3431a559c068314e757851cd8125c3d156e8c61b80d

Contents?: true

Size: 398 Bytes

Versions: 21

Compression:

Stored size: 398 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module DearInventory
  module Validators
    class Boolean < DearInventory::Validator
      extend T::Sig

      sig { override.void }
      def call
        value = instance_variable_get(:@value)
        return if [true, false, nil].include?(value)

        raise_error("expected a Boolean but received #{value.inspect}")
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
dear_inventory-0.2.0 lib/dear_inventory/validators/boolean.rb