Sha256: 8ca53377f1e302dc6de0e8c9fb6f0063e1b8c015a1de5fc4aec7834cbd1aa4be
Contents?: true
Size: 906 Bytes
Versions: 6
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true module Rails module GraphQL class Type # The Boolean scalar type represents +true+ or +false+. # # See http://spec.graphql.org/June2018/#sec-Boolean class Scalar::BooleanScalar < Scalar self.spec_object = true aliases :bool desc 'The Boolean scalar type represents true or false.' FALSE_VALUES = ::ActiveModel::Type::Boolean::FALSE_VALUES class << self def valid_input?(value) valid_token?(value) || value === true || value === false end def valid_output?(*) true # Pretty much anything can be turned into a boolean end def as_json(value) !(value.nil? || FALSE_VALUES.include?(value)) end def deserialize(value) as_json(value) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems