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: big_decimal_typecaster.rb
    path of file: ./repos/active_attr/lib/active_attr/typecasting
    
    the code of the file until where you have to start completion: require "bigdecimal"
require "bigdecimal/util"
require "
    
      def call(value)
        if value.is_a? BigDecimal
          value
        elsif value.is_a? Rational
          value.to_f.to_d
        elsif value.blank?
          nil
        elsif value.respond_to? :to_d
          value.to_d
        else
          BigDecimal(value.to_s)
        end