Class: GraphQL::Extras::Types::Decimal

Inherits:
Schema::Scalar
  • Object
show all
Defined in:
lib/graphql/extras/types.rb

Class Method Summary collapse

Class Method Details

.coerce_input(value, _context) ⇒ Object



41
42
43
44
45
# File 'lib/graphql/extras/types.rb', line 41

def self.coerce_input(value, _context)
  BigDecimal(value.to_s)
rescue ArgumentError
  nil
end

.coerce_result(value, _context) ⇒ Object



47
48
49
# File 'lib/graphql/extras/types.rb', line 47

def self.coerce_result(value, _context)
  value.to_s("F")
end