{"action":"created","issue":{"url":"https://api.github.com/repos/RubyMoney/money/issues/770","repository_url":"https://api.github.com/repos/RubyMoney/money","labels_url":"https://api.github.com/repos/RubyMoney/money/issues/770/labels{/name}","comments_url":"https://api.github.com/repos/RubyMoney/money/issues/770/comments","events_url":"https://api.github.com/repos/RubyMoney/money/issues/770/events","html_url":"https://github.com/RubyMoney/money/issues/770","id":320439930,"number":770,"title":"Container for Money of different currencies","user":{"login":"hmiller-mykey","id":38260477,"avatar_url":"https://avatars1.githubusercontent.com/u/38260477?v=4","gravatar_id":"","url":"https://api.github.com/users/hmiller-mykey","html_url":"https://github.com/hmiller-mykey","followers_url":"https://api.github.com/users/hmiller-mykey/followers","following_url":"https://api.github.com/users/hmiller-mykey/following{/other_user}","gists_url":"https://api.github.com/users/hmiller-mykey/gists{/gist_id}","starred_url":"https://api.github.com/users/hmiller-mykey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmiller-mykey/subscriptions","organizations_url":"https://api.github.com/users/hmiller-mykey/orgs","repos_url":"https://api.github.com/users/hmiller-mykey/repos","events_url":"https://api.github.com/users/hmiller-mykey/events{/privacy}","received_events_url":"https://api.github.com/users/hmiller-mykey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-04T21:46:42Z","updated_at":"2018-05-07T21:27:48Z","closed_at":null,"author_association":"NONE","body":"Hello!\r\n\r\nApologies if this is the wrong place to ask this question.\r\n\r\nI'm looking for guidance with dealing with multiple currencies.\r\n\r\nI have a unique constraint where I always want to keep `Money` of different currency separate(`Money` should never be exchanged). Additionally I want to be able to perform math operations on `Money` with different currency, and have the resultant object that contains each currency seperate.\r\nFor example:\r\n\r\n``` \r\n10 USD + 10 CAD = { 10 USD, 10 CAD }\r\n\r\n10 CAD + 10 CAD = { 20 CAD }\r\n\r\n10 CAD + 10 CAD + 10 USD = { 20 CAD, 10 USD }\r\n```\r\n\r\nBasically what I need is a container object that lets me perform operations with different currency Money, but keeps them separate.\r\n\r\nI haven't been able to find any gems that do something like this.\r\n\r\nHas anyone had any experience with this? \r\nIs there some gem that does this that I cannot find?\r\n\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/RubyMoney/money/issues/comments/387212129","html_url":"https://github.com/RubyMoney/money/issues/770#issuecomment-387212129","issue_url":"https://api.github.com/repos/RubyMoney/money/issues/770","id":387212129,"user":{"login":"printercu","id":1144890,"avatar_url":"https://avatars0.githubusercontent.com/u/1144890?v=4","gravatar_id":"","url":"https://api.github.com/users/printercu","html_url":"https://github.com/printercu","followers_url":"https://api.github.com/users/printercu/followers","following_url":"https://api.github.com/users/printercu/following{/other_user}","gists_url":"https://api.github.com/users/printercu/gists{/gist_id}","starred_url":"https://api.github.com/users/printercu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/printercu/subscriptions","organizations_url":"https://api.github.com/users/printercu/orgs","repos_url":"https://api.github.com/users/printercu/repos","events_url":"https://api.github.com/users/printercu/events{/privacy}","received_events_url":"https://api.github.com/users/printercu/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T21:27:48Z","updated_at":"2018-05-07T21:27:48Z","author_association":"MEMBER","body":"I suggest not to override default implementation, but define separate class like `MultiMoney` or `MoneyCollection`. At least you'll be able to use `Money#+` to sum values with same currency.\r\n\r\nPS. You can define internal store like this `@store = Hash.new { |h, currency| h[currency] = Money.new(0, currency) }`. And then use it like `store[money.currency] += money`."}}
{"actor":{"display_login":"printercu"}}