Last active
October 7, 2017 14:46
Revisions
-
ntl revised this gist
Oct 7, 2017 . No changes.There are no files selected for viewing
-
ntl revised this gist
Oct 7, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def approve(number, expiration_date, amount) def decline(number, expiration_date, amount) @approved.delete_if { |n, e, a| n == number && e == expiration_date && a == amount end end end end -
ntl revised this gist
Oct 7, 2017 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ class InitializerArgumentsPaymentProcessor def initialize(number, expiration_date, amount) @number, @expiration_date, @amount = number, expiration_date, amount end 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ class InstanceMethodPaymentProcessor def call(number, expiration_date, amount) if SomeGateway.(number, expiration_date, amount) true -
ntl renamed this gist
Oct 7, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ntl created this gist
Oct 7, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ class PaymentProcessor def call(number, expiration_date, amount) if SomeGateway.(number, expiration_date, amount) true else false end end class Substitute def initialize @approved = [] end def call(number, expiration_date, amount) @approved.any? do |n, e, a| n == number && e == expiration_date && a == amount end end def approve(number, expiration_date, amount) @approved << [number, expiration_date, amount) end def decline(number, expiration_date, amount) @approved.delete_if { |n, e, a| n == number && e == expiration_date && a == amount end end end end 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ class PaymentProcessor def initialize(number, expiration_date, amount) @number, @expiration_date, @amount = number, expiration_date, amount end def call if SomeGateway.(number, expiration_date, amount) true else false end end class Substitute def call @approved end def approve @approved = true end def decline @approved = false end end end