Our app uses the send
method to call functions on our objects.
Unfortunately, some times the string passed to send
may not be a legit method name in Ruby. Does anyone know of a regexp that would allow us to check this?
And by legit, I mean a method name that doesn't start with "?", etc. I don't care whether the object responds to the method, because we use method_missing
in this case, and we actually want it to be used, which would only happen for methods for which the object doesn't respond.
Technically, I'm looking for a regexp which does this :
Ruby identifiers are consist of alphabets, decimal digits, and the underscore character, and begin with a alphabets(including underscore). There are no restrictions on the lengths of Ruby identifiers.