Class: CARPS::Sheet::Choice

Inherits:
Type
  • Object
show all
Defined in:
lib/carps/mod/sheet/type.rb

Overview

Accept one of a Set of possible values

Instance Method Summary collapse

Methods inherited from Type

#coercion, #empty, #verify

Constructor Details

#initialize(optional, choices) ⇒ Choice

The second argument is the Set of possible values



112
113
114
115
# File 'lib/carps/mod/sheet/type.rb', line 112

def initialize optional, choices
   super optional
   @choices = choices
end

Instance Method Details

#valid(val) ⇒ Object

Only true for a member of the Set of possible values



118
119
120
# File 'lib/carps/mod/sheet/type.rb', line 118

def valid val
   @choices.member? val.downcase
end