Class: Aruba::Contracts::Enum

Inherits:
Contracts::CallableClass
  • Object
show all
Defined in:
lib/aruba/contracts/enum.rb

Overview

Enum

Instance Method Summary collapse

Constructor Details

#initialize(*vals) ⇒ Enum

Create contract



16
17
18
19
# File 'lib/aruba/contracts/enum.rb', line 16

def initialize(*vals)
  super()
  @vals = vals
end

Instance Method Details

#valid?(val) ⇒ Boolean

Check if value is part of array

Returns:

  • (Boolean)


22
23
24
# File 'lib/aruba/contracts/enum.rb', line 22

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