Daily Ruby Tips (@daily_ruby_tips) header
Daily Ruby Tips (@daily_ruby_tips) profile picture

5 days per week, a ruby 💡tip - By @blaked_84

🇫🇷
Joined July 2018
Get last output in console
7
Splat operator and array 💻 Copyable example at: beckr.fr/daily_ruby_tips
1
2
8
Writing large Integers 💻 Copyable example at: beckr.fr/daily_ruby_tips
1
8
Enumerable#find Do you know you can pass a proc to `find` to return a default value if no object matches? 📖 Doc: ruby-doc.org/core-2.5.1/Enum… 💻 Copyable example at: beckr.fr/daily_ruby_tips
1
2
10
Enumerable#partition 📖 Example from ruby-doc: ruby-doc.org/core-2.5.1/Enum… 💻 Copyable example at: beckr.fr/daily_ruby_tips
2
17
Unescaping text. Sometime I have to handle escaped text and... no regex tip here. Since ruby 2.5 I use `undump` 😀 📖 Doc: ruby-doc.org/core-2.5.0/Stri… 💻 Copyable example at: beckr.fr/daily_ruby_tips
2
11
`split` is not the only solution to split strings. 📖 Doc: ruby-doc.org/core-2.5.0/Stri… & ruby-doc.org/core-2.5.0/Stri… 💻 Copyable example at: beckr.fr/daily_ruby_tips
1
1
4
String#strip I'm sure you know "strip". What about "strip!", "lstrip" and "rstrip"? 📖 Doc: ruby-doc.org/core-2.5.0/Stri… 💻 Copyable example at: beckr.fr/daily_ruby_tips
4
String#center Before, I used `puts "###### Title ######"` to print title in stdout. But I hated to center a text manually. Now I use 👇 📖 Doc: ruby-doc.org/core-2.5.0/Stri… 💻 Copyable example at: beckr.fr/daily_ruby_tips