You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: type_cast.rb
    path of file: ./repos/activerecord-jdbc-adapter/lib/arjdbc/jdbc
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'active_record/connection_adapters/column'

module ActiveRecord::ConnectionAdapters
  module Jdbc
    # Type casting methods taken from AR 4.1's Column class.
    # @private Sim
    
      def value_to_decimal(value)
        # Using .class is faster than .is_a? and
        # subclasses of BigDecimal will be handled
        # in the else clause
        if value.class == BigDecimal
          value
        elsif value.respond_to?(:to_d)
          value.to_d
        else
          value.to_s.to_d
        end