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: util.rb
    path of file: ./repos/truffleruby/lib/mri/bigdecimal
    
    the code of the file until where you have to start completion: # frozen_string_literal: false
#
#--
# bigdecimal/util extends various native classes to provide the #to_
    
  def to_d(*args)
    BigDecimal(self) unless self.imag.zero? # to raise eerror

    if args.length == 0
      case self.real
      when Rational
        BigDecimal(self.real) # to raise error
      end