Class: JsonApiClient::Schema::Types::Boolean

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

Class Method Summary collapse

Class Method Details

.cast(value, default) ⇒ Object


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

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