Sha256: 954eee8ee6c0366172ea36e9186015afbd3bca6a6bbf7b5a47d1e1ca009ef5b0

Contents?: true

Size: 384 Bytes

Versions: 34

Compression:

Stored size: 384 Bytes

Contents

require 'contracts'

# Aruba
module Aruba
  # Contracts
  module Contracts
    # Enum
    class Enum < ::Contracts::CallableClass
      private

      attr_reader :vals

      public

      # Create contract
      def initialize(*vals)
        @vals = vals
      end

      # Check if value is part of array
      def valid?(val)
        vals.include? val
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 3 rubygems

Version Path
aruba-1.0.4 lib/aruba/contracts/enum.rb
aruba-1.0.3 lib/aruba/contracts/enum.rb
aruba-1.0.2 lib/aruba/contracts/enum.rb
aruba-1.0.1 lib/aruba/contracts/enum.rb
aruba-1.0.0 lib/aruba/contracts/enum.rb
aruba-0.14.14 lib/aruba/contracts/enum.rb
aruba-0.14.13 lib/aruba/contracts/enum.rb
aruba-1.0.0.pre.alpha.5 lib/aruba/contracts/enum.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/aruba-0.14.12/lib/aruba/contracts/enum.rb
aruba-0.14.12 lib/aruba/contracts/enum.rb
aruba-0.14.11 lib/aruba/contracts/enum.rb
aruba-0.14.10 lib/aruba/contracts/enum.rb
aruba-1.0.0.pre.alpha.4 lib/aruba/contracts/enum.rb
aruba-1.0.0.pre.alpha.3 lib/aruba/contracts/enum.rb
aruba-0.14.9 lib/aruba/contracts/enum.rb
aruba-0.14.8 lib/aruba/contracts/enum.rb
aruba-0.14.7 lib/aruba/contracts/enum.rb
aruba-0.14.6 lib/aruba/contracts/enum.rb
aruba-0.14.5 lib/aruba/contracts/enum.rb
aruba-0.14.4 lib/aruba/contracts/enum.rb