Sha256: 3872c5857683a18e9b11f4aceb4d6a17a463d0d0185202f67d8ae567775a1800

Contents?: true

Size: 496 Bytes

Versions: 6

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

using SmartCore::Ext::BasicObjectAsObject

# @api public
# @since 0.3.0
SmartCore::Types::Protocol.define_type(:InstanceOf) do |type|
  type.runtime_attributes_checker do |runtime_attrs|
    runtime_attrs.any? && runtime_attrs.all? do |runtime_attr|
      runtime_attr.is_a?(::Class)
    end
  end

  type.define_checker do |value, expected_types|
    expected_types.any? && expected_types.any? do |expected_type|
      value.is_a?(expected_type)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
smart_types-0.8.0 lib/smart_core/types/protocol/instance_of.rb
smart_types-0.7.1 lib/smart_core/types/protocol/instance_of.rb
smart_types-0.7.0 lib/smart_core/types/protocol/instance_of.rb
smart_types-0.6.0 lib/smart_core/types/protocol/instance_of.rb
smart_types-0.4.0 lib/smart_core/types/protocol/instance_of.rb
smart_types-0.3.0 lib/smart_core/types/protocol/instance_of.rb