{"record":{"id":"dad2e598cf9a3edf","repo":"RubyMoney/money","slug":"can-not-divide-by-money","errorCode":null,"errorMessage":"Can not divide by Money","messagePattern":"Can not divide by Money","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/money/money/arithmetic.rb","lineNumber":211,"sourceCode":"    # +Money/Numeric+ returns +Money+. +Money/Money+ returns +Float+.\n    #\n    # @param [Money, Numeric] value Number to divide by.\n    #\n    # @return [Money] The resulting money if you divide Money by a number.\n    # @return [Float] The resulting number if you divide Money by a Money.\n    #\n    # @example\n    #   Money.new(100) / 10            #=> #<Money @fractional=10>\n    #   Money.new(100) / Money.new(10) #=> 10.0\n    #\n    def /(other)\n      if other.is_a?(self.class)\n        exchanged = other.exchange_to(currency)\n        raise ZeroDivisionError, \"divided by Money(0)\" if exchanged.zero?\n\n        fractional / as_d(exchanged.fractional).to_f\n      else\n        raise TypeError, \"Can not divide by Money\" if other.is_a?(CoercedNumeric)\n\n        other = as_d(other)\n        raise ZeroDivisionError, \"divided by zero\" if other.zero?\n\n        dup_with(fractional: fractional / other)\n      end\n    end\n\n    # Synonym for +#/+.\n    #\n    # @param [Money, Numeric] value Number to divide by.\n    #\n    # @return [Money] The resulting money if you divide Money by a number.\n    # @return [Float] The resulting number if you divide Money by a Money.\n    #\n    # @see #/\n    #\n    def div(value)","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/RubyMoney/money/blob/26e2829c34f165847040a5a40d4d2daa5eb72927/lib/money/money/arithmetic.rb#L193-L229","documentation":"Error \"Can not divide by Money\" thrown in RubyMoney/money.","triggerScenarios":"Thrown at lib/money/money/arithmetic.rb:211 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26e2829c34f165847040a5a40d4d2daa5eb72927","analyzedAt":"2026-08-23T17:41:07.306Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}