I really feel naive asking this, but I'm going to go ahead and ask :
What is the importance of
: in ruby ?
I have seen it being used in a number of places like
params[:id] or like
x < :length.
A colon denotes a "symbol". A symbol is like a string, but it is immutable (you can't change its contents). Behind the scenes, it also takes up less memory, since a symbol only needs to exist once in memory (i.e., two strings called "length" will exist twice in memory, but two symbols called :length will point to the same object).
Symbols are Strings, just with an important difference, Symbols are immutable.
RubyDoc: Symbol objects represent names and some strings inside the Ruby interpreter. They are generated using the :name and :"string" literals syntax, and by the various to_sym methods.
Here are some good places to learn more about symbols
It is syntax indication of type for interpreter.