r/ruby • u/japiber • Dec 25 '15
Ruby 2.3.0 released
https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/
132
Upvotes
3
u/rfdonnelly Dec 26 '15
The best addition didn't make it to the announcement.
From: https://github.com/ruby/ruby/blob/v2_3_0/NEWS
* indented here document: * new string literal, here document starts with `<<~`. refer doc/syntax/literals.rdoc for more details. [Feature #9098]
From: https://github.com/ruby/ruby/blob/v2_3_0/doc/syntax/literals.rdoc
To have indented content as well as an indented closing identifier, you can use a “squiggly” heredoc, which uses a “~” instead of a “-” after <<:
expected_result = <<~SQUIGGLY_HEREDOC This would contain specially formatted text. That might span many lines SQUIGGLY_HEREDOCThe indentation of the least-indented line will be removed from each line of the content. Note that empty lines and lines consisting solely of literal tabs and spaces will be ignored for the purposes of determining indentation, but escaped tabs and spaces are considered non-indentation characters.
0
3
u/hak8or Dec 25 '15 edited Dec 25 '15
So they have constants for only strings? Why not put in a const keyword of sorts, or let freeze work on anything?Took a while, but wait, this gem is part of the languag or standard library?
The performance updates are most welcome though.