Skip to content

Instantly share code, notes, and snippets.

@ClayShentrup
Last active December 29, 2017 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClayShentrup/8faaa0e70dd46daee39ee89f0ecac5ef to your computer and use it in GitHub Desktop.
Save ClayShentrup/8faaa0e70dd46daee39ee89f0ecac5ef to your computer and use it in GitHub Desktop.
Sandi Metz COC
# 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
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