{"record":{"id":"ebe0d30adfbd9927","repo":"RubyMoney/money","slug":"exchange-with-must-be-implemented","errorCode":null,"errorMessage":"#exchange_with must be implemented","messagePattern":"#exchange_with must be implemented","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"lib/money/bank/base.rb","lineNumber":102,"sourceCode":"      # +to_currency+.\n      #\n      # @abstract Subclass and override +#exchange_with+ to implement a custom\n      #  +Money::Bank+ class.\n      #\n      # @raise NotImplementedError\n      #\n      # @param [Money] from The +Money+ object to exchange from.\n      # @param [Money::Currency, String, Symbol] to_currency The currency\n      #  string or object to exchange to.\n      # @yield [n] Optional block to use to round the result after making\n      #  the exchange.\n      # @yieldparam [Float] n The result after exchanging from one currency to\n      #  the other.\n      # @yieldreturn [Integer]\n      #\n      # @return [Money]\n      def exchange_with(from, to_currency, &)\n        raise NotImplementedError, \"#exchange_with must be implemented\"\n      end\n\n      # Given two currency strings or object, checks whether they're both the\n      # same currency. Return +true+ if the currencies are the same, +false+\n      # otherwise.\n      #\n      # @param [Money::Currency, String, Symbol] currency1 The first currency\n      #  to compare.\n      # @param [Money::Currency, String, Symbol] currency2 The second currency\n      #  to compare.\n      #\n      # @return [Boolean]\n      #\n      # @example\n      #   same_currency?(\"usd\", \"USD\")                #=> true\n      #   same_currency?(\"usd\", \"EUR\")                #=> false\n      #   same_currency?(\"usd\", Currency.new(\"USD\"))   #=> true\n      #   same_currency?(\"usd\", \"USD\")                #=> true","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/RubyMoney/money/blob/26e2829c34f165847040a5a40d4d2daa5eb72927/lib/money/bank/base.rb#L84-L120","documentation":"Error \"#exchange_with must be implemented\" thrown in RubyMoney/money.","triggerScenarios":"Thrown at lib/money/bank/base.rb:102 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"}