Class: Mountapi::Schema::Boolean

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/mountapi/schema/boolean.rb

Overview

Schema implementation for Boolean type

Instance Method Summary collapse

Methods included from Base

included

Instance Method Details

#cast(value) ⇒ Object

cast value to boolean it must be either true or false (string or boolean)



13
14
15
16
17
# File 'lib/mountapi/schema/boolean.rb', line 13

def cast(value)
  word = value.to_s
  raise_cast_error(value) unless %w(true false).include?(word)
  word == "true"
end