1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Use alias instead of alias_method within core classes

This commit is contained in:
Mike Dvorkin 2010-11-09 19:50:52 -08:00
parent d401b1471d
commit b447e8e33d
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@
#------------------------------------------------------------------------------
class Class
methods.grep(/instance_methods$/) do |name|
alias_method :"original_#{name}", name
alias :"original_#{name}" :"#{name}"
define_method name do |*args|
methods = self.send(:"original_#{name}", *args)
methods.instance_variable_set('@__awesome_methods__', self) # Evil?!

View file

@ -7,7 +7,7 @@ class Object
methods.grep(/methods$/) do |name|
next if name.to_s.include? 'instance' # Instance methods are trapped in Class.
alias_method :"original_#{name}", name
alias :"original_#{name}" :"#{name}"
define_method name do |*args|
methods = self.send(:"original_#{name}", *args)
methods.instance_variable_set('@__awesome_methods__', self) # Evil?!