Sha256: 04956192fd0ca6cbea29cff7d8eca1d232e778ab50d392ec83fbd0e1da6be9e6

Contents?: true

Size: 298 Bytes

Versions: 3

Compression:

Stored size: 298 Bytes

Contents

require 'contracts'

module Aruba
  module Contracts
    class IsA < ::Contracts::CallableClass
      private

      attr_reader :vals

      public

      def initialize(*vals)
        @vals = vals
      end

      def valid?(val)
        vals.any? { |v| val.is_a? v }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aruba-0.8.1 lib/aruba/contracts/is_a.rb
aruba-0.8.0 lib/aruba/contracts/is_a.rb
aruba-0.8.0.pre3 lib/aruba/contracts/is_a.rb