In Ruby, you can call a protected static method on an instance of a class by using the send
method.
Here's an example:
main.rb199 chars9 lines
In the example above, we define a class called MyClass
and give it a protected static method called my_protected_static_method
.
We then create an instance of the class and use the send
method to call the protected static method on that instance.
Note that we need to pass the method name as a symbol to send
, and we must also use the protected_class_method
keyword to define the method as protected.
gistlibby LogSnag