Skip to content

Instantly share code, notes, and snippets.

@nathan-appere nathan-appere/interface.rb
Last active Aug 29, 2015

Embed
What would you like to do?
Enforce interface manually because sometimes ruby lets you down.
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
You can’t perform that action at this time.