Last active
August 29, 2015 14:11
-
-
Save nathan-appere/dfdd4fa5fa81f080c70f to your computer and use it in GitHub Desktop.
Enforce interface manually because sometimes ruby lets you down.
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 Coupon | |
class << self | |
def enforce_interface! | |
methods = self.instance_methods(false) | |
[:m].each do |method_name| | |
unless methods.include? method_name | |
raise "#{method_name} should be implemented" | |
end | |
end | |
end | |
end | |
end | |
class SharingCoupon < Coupon | |
def m | |
end | |
enforce_interface! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment