Last active
December 29, 2017 22:32
-
-
Save ClayShentrup/8faaa0e70dd46daee39ee89f0ecac5ef to your computer and use it in GitHub Desktop.
Sandi Metz COC
This file contains 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
# Source: https://www.youtube.com/watch?v=f5I1iyso29U&t=23m44s | |
class Shock | |
def cost(type) | |
case type | |
when :front | |
FrontShockCost.new.compute | |
when :rear | |
RearShockCost.new.compute | |
when :lefty | |
LeftyShockCost.new.compute | |
else | |
ShockCost.new.compute | |
end | |
end | |
end |
This file contains 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
class Shock | |
def cost(type) | |
"#{type.to_s.titleize}Shock".constantize.new.compute | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment