Created
January 25, 2013 21:59
-
-
Save valachi/4638282 to your computer and use it in GitHub Desktop.
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 characters
| class Stweie | |
| ALLOWED_METHODS = [:methods, :method, :why] | |
| def hello | |
| 'Hello' | |
| end | |
| class_eval do | |
| def why | |
| 'WHY' | |
| end | |
| instance_methods.each do |method| | |
| undef_method method unless method_belongs?(method) | |
| end | |
| end | |
| instance_eval do | |
| def allowed_methods | |
| ALLOWED_METHODS | |
| end | |
| end | |
| def method_missing(method_name) | |
| puts "You've asked me to #{method_name}, but where are my money, BITCH?" | |
| end | |
| private | |
| def self.method_belongs?(method_name) | |
| ALLOWED_METHODS.include?(method) or method =~ /^__/ | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment