Sha256: ac983c6d9976df5ae91ada6d6048c193259040612f22b2ae2e76636515674119

Contents?: true

Size: 304 Bytes

Versions: 14

Compression:

Stored size: 304 Bytes

Contents

GraphQL::BOOLEAN_TYPE = GraphQL::ScalarType.define do
  # Everything else is nil
  ALLOWED_INPUTS = [true, false]

  name "Boolean"
  description "Represents `true` or `false` values."

  coerce_input -> (value) { ALLOWED_INPUTS.include?(value) ? value : nil }
  coerce_result -> (value) { !!value }
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-0.18.10 lib/graphql/boolean_type.rb
graphql-0.18.9 lib/graphql/boolean_type.rb
graphql-0.18.8 lib/graphql/boolean_type.rb
graphql-0.18.7 lib/graphql/boolean_type.rb
graphql-0.18.6 lib/graphql/boolean_type.rb
graphql-0.18.5 lib/graphql/boolean_type.rb
graphql-0.18.4 lib/graphql/boolean_type.rb
graphql-0.18.3 lib/graphql/boolean_type.rb
graphql-0.18.2 lib/graphql/boolean_type.rb
graphql-0.18.1 lib/graphql/boolean_type.rb
graphql-0.18.0 lib/graphql/boolean_type.rb
graphql-0.17.2 lib/graphql/boolean_type.rb
graphql-0.17.1 lib/graphql/boolean_type.rb
graphql-0.17.0 lib/graphql/boolean_type.rb