Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How do you alias a self.method?

Good day everybody!

I was just curious, because I try to do this and I get an error, but how do I alias a 'self.' method within a module? For instance...

module Optimize
  alias_method :kn_optimize_weapon_later, :eek:ptimize_weapon
  def self.optimize_weapon(*args)
    kn_optimize_weapon_later(*args)
    # ...
  end
end

Obviously I can always do it the standard way, but I get an error whenever I try to do it to 'self.' methods and I can't include 'self.' in the alias_method itself because it turns into a symbol and raises a syntax error.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top