File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1602,6 +1602,28 @@ hash.exclude?(:key)
1602
1602
string.exclude?('substring')
1603
1603
----
1604
1604
1605
+ === Prefer using squiggly heredoc over `strip_heredoc` [[prefer-squiggly-heredoc]]
1606
+
1607
+ If you're using Ruby 2.3 or higher, prefer squiggly heredoc (`<<~`) over Active Support's `strip_heredoc`.
1608
+
1609
+ [source,ruby]
1610
+ ----
1611
+ # bad
1612
+ <<EOS.strip_heredoc
1613
+ some text
1614
+ EOS
1615
+
1616
+ # bad
1617
+ <<-EOS.strip_heredoc
1618
+ some text
1619
+ EOS
1620
+
1621
+ # good
1622
+ <<~EOS
1623
+ some text
1624
+ EOS
1625
+ ----
1626
+
1605
1627
=== Prefer `to_fs` for Formatted Strings [[prefer-to-fs]]
1606
1628
1607
1629
If you're using Rails 7.0 or higher, prefer `to_fs` over `to_formatted_s`. `to_formatted_s` is just too cumbersome for a method used that frequently.
You can’t perform that action at this time.
0 commit comments