I'm using RubyMine which informs me that
unsubscribe_from_all_notifications
...is too long for a method name. What's the max length?
Generally length may be 1 char for loop counters, 1 word for condition/loop variables, 1-2 words for methods, 2-3 words for classes, 3-4 words for globals. Use specific names for variables, for example "value", "equals", "data", ... are not valid names for any case. Use meaningful names for variables.
Ruby allows method names and other identifiers to contain such characters.) Method names may contain letters, numbers, an _ (underscore or low line) or a character with the eight bit set. Method names may end with a ! (bang or exclamation mark), a ? (question mark) or = equals sign.
Rules to Declare a Variable Java keywords cannot be used as variable names. Variable names are case-sensitive. There is no limit on the length of a variable name but by convention, it should be between 4 to 15 chars.
RubyMine lies :-) Or at least does not mean that it is a limitation of Ruby interpreter.
looong_name = "a" * 10000; # => "aaaaaaaaa.....
a_class = Class.new
a_class.__send__(:define_method, looong_name) { :hello }
a_class.new.__send__(looong_name) # => :hello
puts a_class.instance_methods.inspect # you better not run this :-)
AFAIK there is no limit to the size of a method name in ruby.
Most likely you have some coding style setup in RubyMine which is showing you this warning. If on a mac check RubyMine > Preferences > Code Style > Ruby and see if there is some sort of preference in there.
Just to let you know I use RubyMine as well but I do not see this type of coding style set for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With