Created
April 30, 2014 08:16
-
-
Save shahoxo/87e7e0817bf657b1c289 to your computer and use it in GitHub Desktop.
しーあん
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 Xian < BasicObject | |
def method_missing(*args, &block) | |
self.class.absolute | |
end | |
def self.method_missing(*args, &block) | |
self.absolute | |
end | |
def self.absolute | |
name.constantize | |
end | |
methods.each do |m| | |
next if [:name, :to_s, :inspect, :method_missing, :absolute].include? m | |
next if m.to_s.match 'print' | |
define_singleton_method m do |*args, &block| | |
self.absolute | |
end | |
end | |
instance_methods do |m| | |
next if [:method_missing].include? m | |
define_method m do |*args, &block| | |
self.class.absolute | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment