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 @@ -1575,6 +1575,28 @@ hash.exclude?(:key)
1575
1575
string.exclude?('substring')
1576
1576
----
1577
1577
1578
+ === Prefer using squiggly heredoc over `strip_heredoc` [[prefer-squiggly-heredoc]]
1579
+
1580
+ If you're using Ruby 2.3 or higher, prefer squiggly heredoc (`<<~`) over Active Support's `strip_heredoc`.
1581
+
1582
+ [source,ruby]
1583
+ ----
1584
+ # bad
1585
+ <<EOS.strip_heredoc
1586
+ some text
1587
+ EOS
1588
+
1589
+ # bad
1590
+ <<-EOS.strip_heredoc
1591
+ some text
1592
+ EOS
1593
+
1594
+ # good
1595
+ <<~EOS
1596
+ some text
1597
+ EOS
1598
+ ----
1599
+
1578
1600
=== Prefer `to_fs` for Formatted Strings [[prefer-to-fs]]
1579
1601
1580
1602
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