Created
January 25, 2013 22:02
-
-
Save valachi/4638303 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 | |
| instance_methods.each do |method| | |
| undef_method method unless method_belongs?(method) | |
| end | |
| class_eval do | |
| def why | |
| 'WHY' | |
| 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