Class: Module
Instance Method Summary collapse
-
#alias_method_chain(target, feature) ⇒ Object
Encapsulates the common pattern of:.
Instance Method Details
#alias_method_chain(target, feature) ⇒ Object
Encapsulates the common pattern of:
alias_method :foo_without_feature, :foo
alias_method :foo, :foo_with_feature
With this, you simply do:
alias_method_chain :foo, :feature
And both aliases are set up for you.
12 13 14 15 |
# File 'lib/gamebox/lib/aliasing.rb', line 12 def alias_method_chain(target, feature) alias_method "#{target}_without_#{feature}", target alias_method target, "#{target}_with_#{feature}" end |