Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Module
- def alias_method_chain(target, feature)
- with_method, without_method = "#{target}_with_#{feature}", "#{target}_without_#{feature}"
- alias_method without_method, target
- alias_method target, with_method
- case
- when public_method_defined?(without_method)
- public target
- when protected_method_defined?(without_method)
- protected target
- when private_method_defined?(without_method)
- private target
- end
- end
- end
Add Comment
Please, Sign In to add comment