Sha256: b2b41b03c5f5496124f1a21c51b4229c75d4e5e513a8e7a8eef2f8d2ca3a5132

Contents?: true

Size: 287 Bytes

Versions: 12

Compression:

Stored size: 287 Bytes

Contents

require 'contracts'

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

      attr_reader :vals

      public

      def initialize(*vals)
        @vals = vals
      end

      def valid?(val)
        vals.include? val
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
aruba-0.11.0.pre lib/aruba/contracts/enum.rb
aruba-0.10.2 lib/aruba/contracts/enum.rb
aruba-0.10.1 lib/aruba/contracts/enum.rb
aruba-0.10.0 lib/aruba/contracts/enum.rb
aruba-0.10.0.pre2 lib/aruba/contracts/enum.rb
aruba-0.10.0.pre lib/aruba/contracts/enum.rb
aruba-0.9.0 lib/aruba/contracts/enum.rb
aruba-0.9.0.pre2 lib/aruba/contracts/enum.rb
aruba-0.9.0.pre lib/aruba/contracts/enum.rb
aruba-0.8.1 lib/aruba/contracts/enum.rb
aruba-0.8.0 lib/aruba/contracts/enum.rb
aruba-0.8.0.pre3 lib/aruba/contracts/enum.rb