reflection - Ruby class method reference -


in ruby, can reference method , pass in callback-like fashion in same scope this:

my_method = method(:method_name) 

how reference class method defined on class?

so if had:

class myclass   class << self       def my_method         // ... stuff       end   end end 

how reference method in different class use in method(...) call?

answered own question thinking:

you don't need method(...) @ in case.

instead can use:

myclass.public_method(:my_method) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -