Fixed bug where Numeric.amortize wouldn't work without first calling …#43
Open
joeljensen wants to merge 1 commit intomarksweston:masterfrom
Open
Fixed bug where Numeric.amortize wouldn't work without first calling …#43joeljensen wants to merge 1 commit intomarksweston:masterfrom
joeljensen wants to merge 1 commit intomarksweston:masterfrom
Conversation
…Amortization.new ## Before change, when calling amortize method on number, without first instanciating an Amortization, the numeric monkey patch isn't loaded [1] pry(main)> require 'finance' => true [2] pry(main)> include Finance => Object [3] pry(main)> rate = Rate.new(0.3875,:apr,:duration => 360) => Rate.new(0.387500, :apr) [4] pry(main)> 270000.amortize(rate) NoMethodError: undefined method `amortize' for 270000:Fixnum from (pry):4:in `__pry__' ## instanciating Amortization, now the patch is loaded. [5] pry(main)> Amortization.new(100000,rate) => Amortization.new(100000) ## now it works [6] pry(main)> 270000.amortize(rate) => Amortization.new(270000) [7] pry(main)> [7] pry(main)> ## After change, changed autoload to require, now it's always loaded. [1] pry(main)> require 'finance' => true [2] pry(main)> include Finance => Object [3] pry(main)> rate = Rate.new(0.3875,:apr,:duration => 360) => Rate.new(0.387500, :apr) [4] pry(main)> 270000.amortize(rate) => Amortization.new(270000)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…Amortization.new
Before change, when calling amortize method on number, without first instanciating an Amortization, the numeric monkey patch isn't loaded
[1] pry(main)> require 'finance'
=> true
[2] pry(main)> include Finance
=> Object
[3] pry(main)> rate = Rate.new(0.3875,:apr,:duration => 360)
=> Rate.new(0.387500, :apr)
[4] pry(main)> 270000.amortize(rate)
NoMethodError: undefined method
amortize' for 270000:Fixnum from (pry):4:inpry'instanciating Amortization, now the patch is loaded.
[5] pry(main)> Amortization.new(100000,rate)
=> Amortization.new(100000)
now it works
[6] pry(main)> 270000.amortize(rate)
=> Amortization.new(270000)
[7] pry(main)>
[7] pry(main)>
After change, changed autoload to require, now it's always loaded.
[1] pry(main)> require 'finance'
=> true
[2] pry(main)> include Finance
=> Object
[3] pry(main)> rate = Rate.new(0.3875,:apr,:duration => 360)
=> Rate.new(0.387500, :apr)
[4] pry(main)> 270000.amortize(rate)
=> Amortization.new(270000)