I am new to Ruby.
Can someone explain to me what the difference is between the characters preceding methods listed for a class in Ruby’s documentation?
Here’s an example: For the String class, the characters :: before ::new and ::try_convert versus the # before methods like #chomp, etc.
It specifies the “level” of methods.
::for class-level methods,#for instance-level methods.For example, when you see
String::new, you know you have to call it on aStringclass directlyBut when you see
String#gsub, you understand that you need an instance ofStringto call this method