I recently discovered that ls in pry can take an argument like so: ls -l.
My initial question is what the -l part actually is - it is clearly not a string or symbol, and there is no local variable or method l defined, so is there something else going on behind the scenes?
As an extension to my question, is ls just a "normal" Ruby method defined by pry, or does it behave slightly differently?
I also noted that you get a different output if you pass a string (ls 'l') or symbol (ls :l). Is there a full reference of the possible options?
Passing
-lworks as the whole line is evaluated as a string by thepry_evalmethod. From that it matches the beginning against an existing command and extracts the rest as options to be passed in. From the Pry documentation:You can see the full list of options by running
ls -h. This will return: