Class: JSONAPI::Consumer::Schema::Types::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/consumer/schema.rb

Class Method Summary collapse

Class Method Details

.cast(value, default) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/jsonapi/consumer/schema.rb', line 36

def self.cast(value, default)
  case value
    when "false", "0", 0, false
      false
    when "true", "1", 1, true
      true
    else
      # if it's unknown, use the default value
      default
  end
end