TLK TLK - 5 months ago 17
Ruby Question

What's the maximum length of a method name in ruby?

I'm using RubyMine which informs me that

unsubscribe_from_all_notifications too long for a method name. What's the max length?


RubyMine lies :-) Or at least does not mean that it is a limitation of Ruby interpreter.

looong_name = "a" * 10000; # => "aaaaaaaaa.....
a_class =
a_class.__send__(:define_method, looong_name) { :hello } # => :hello

puts a_class.instance_methods.inspect # you better not run this :-)