Determining method's visibility on the fly

后端 未结 3 1668
执笔经年
执笔经年 2021-01-19 02:45

I am writing a method that will define an instance method inside a class; something similar to attr_accessor:

class Foo
  custom_method(:foo)
end
         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 03:01

    You can use Module#private_method_defined? to verify if a method is defined as private

提交回复
热议问题