Class: Superstore::Types::BooleanType

Inherits:
Base
  • Object
show all
Defined in:
lib/superstore/types/boolean_type.rb

Constant Summary collapse

TRUE_VALS =
[true, 'true', '1']
FALSE_VALS =
[false, 'false', '0']

Instance Method Summary collapse

Methods inherited from Base

#type

Instance Method Details

#cast_value(value) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/superstore/types/boolean_type.rb', line 7

def cast_value(value)
  if TRUE_VALS.include?(value)
    true
  elsif FALSE_VALS.include?(value)
    false
  end
end