Ruby_and_search_engines
The same way you have to be a bit careful when reading or looking into news, you have to be careful when learning how to use Ruby.
I think Ruby is about 30 years old.. and a lot of info out there is dated.
Example:
I was looking into TraceSpy
(the gem). It has a dependency on qo
(that has a dependency on any
).
Ruby introduced pattern-matching
via case-in
as an experimental feature in version 2.7. I am using Ruby 3.4.2.
p ['Laban', 23].case
in [/^L/, Integer] then true
else false
end
The gem any
creates an any-type, called Any. You don’t need that.. you could match to *
or Object
.
And qo
solves the problem on pattern-matching using case-when
(before case-in
existed).
There are a lot of gems out there solving problems that don’t exist any more. A lot of code was written before a language feature existed.
Rationals didn’t exist pre version 2.1. Hash#to_proc appeared 2.3.8. Regexp#named_captures 2.4.10. Hash#slice 2.5.9. etc. etc.
If you read something on a forum about ruby and the version of Ruby used is older than 3.1.. make sure the info is still valid.
When reading about a gem and downloading it.. check when it was latest updated.
There is an actual need for a better library distribution than gem
..