Skip to content

BigDecimal not working with Ruby 2.7+ because #new was removed #216

@sumirolabs

Description

@sumirolabs

BigDecimal#new has been marked for deprecation for awhile and it looks like it finally happened in Ruby 2.7? This broke our configuration that used #new as the parser:

element :payment, BigDecimal, :tag => 'payment', :parser => :new

I have been able to register a new SupportedType and get the new syntax working:

module HappyMapper
  module SupportedTypes
    register_type BigDecimal do |value|
      BigDecimal(value) if value && !value.empty?
    end
  end
end

Is the right approach or am I missing some other way to solve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions