Class: Aruba::Contracts::Enum
- Inherits:
-
Contracts::CallableClass
- Object
- Contracts::CallableClass
- Aruba::Contracts::Enum
- Defined in:
- lib/aruba/contracts/enum.rb
Overview
Enum
Instance Method Summary collapse
-
#initialize(*vals) ⇒ Enum
constructor
Create contract.
-
#valid?(val) ⇒ Boolean
Check if value is part of array.
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
22 23 24 |
# File 'lib/aruba/contracts/enum.rb', line 22 def valid?(val) vals.include? val end |