Module: Dry::Types::Coercions::JSON

Extended by:
Dry::Types::Coercions
Defined in:
lib/dry/types/coercions/json.rb

Class Method Summary collapse

Methods included from Dry::Types::Coercions

empty_str?, to_date, to_date_time, to_nil, to_time

Class Method Details

.to_decimal(input) ⇒ BigDecimal?

Parameters:

  • input (#to_d, Object)

Returns:

  • (BigDecimal?)


14
15
16
# File 'lib/dry/types/coercions/json.rb', line 14

def self.to_decimal(input)
  input.to_d unless empty_str?(input)
end