Skip to content

Instantly share code, notes, and snippets.

@shahoxo
Created April 30, 2014 08:16
Show Gist options
  • Save shahoxo/87e7e0817bf657b1c289 to your computer and use it in GitHub Desktop.
Save shahoxo/87e7e0817bf657b1c289 to your computer and use it in GitHub Desktop.
しーあん
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